Lovable

AI images and video in your Lovable app

Paste one prompt into Lovable and your app can make images, video and voiceovers with 450+ AI models (Veo, Kling, Seedance, Nano Banana, GPT Image, FLUX) through one GenMagic API key. Pay per result.

Set up

Three steps

  1. 1. Get a key

    Create a free GenMagic account and an API key. It comes with a $0.50 starter balance.

  2. 2. Store it in Lovable

    In Lovable, open Cloud, then Secrets, and add a secret named GENMAGIC_API_KEY with your key. Lovable passes secrets only to your app's Edge Functions, never to the browser. Lovable's guide.

  3. 3. Paste this prompt

    It gives Lovable everything it needs: where to call GenMagic from, the requests, the answers and the errors. Change the last line to what you want to build.

    Prompt for Lovable
    Add AI image and video generation to this app with the GenMagic API.
    
    - API reference: https://genmagic.co/llms.txt and https://genmagic.co/openapi.json. Base URL: https://genmagic.co/api/v1.
    - My API key is stored as the secret GENMAGIC_API_KEY. Call GenMagic only from a Supabase Edge Function, reading the key with Deno.env.get("GENMAGIC_API_KEY"), never from browser code. Send the headers "Authorization: Bearer <key>" and "X-GenMagic-Client: lovable-app/1.0".
    - Images: POST /images/generations with {"prompt", "size": "1024x1024" | "1792x1024" | "1024x1792", optional "model", optional "image" (an image URL or data URL to edit)}. The image URL is data[0].url.
    - Video: POST /videos with {"prompt", "aspect_ratio": "16:9" | "9:16" | "1:1", optional "duration" in seconds, optional "model", optional "image" (an opening frame URL)}. It answers 202 with an "id". Poll GET /videos/{id} every 5 seconds until "status" is "completed" (the clip is at "url") or "failed" (show "error").
    - Speech: POST /audio/speech with {"input", optional "voice"}. The response body is the audio file.
    - Models and prices: GET /models?category=image (or video), no key needed. Each model has an "id", a "name" and pricing.est_per_generation_usd; show the price next to each model in the picker.
    - Each response has an X-Cost-Cents header with what the call cost. Handle 402 (the GenMagic balance is empty) and 429 (too many requests: wait and retry) with a clear message.
    
    Build: An image generator page: a prompt box, a model picker that shows each model's price, a size choice, and a grid of the results with download buttons.

Lovable may ask to turn on Cloud first, since a key needs a backend to stay private. Do not name the secret with a VITE_ prefix: Lovable refuses those, because they would reach the browser.

Lovable's own agent can also make the images your app ships with (a hero, icons, product shots) while you build: in Connectors choose Add custom, then MCP server, paste the sign-in address from the MCP page and click Add & authorize. GenMagic MCP server.

Ideas

What to put on the last line

An image generator page: a prompt box, a model picker that shows each model's price, a size choice, and a grid of the results with download buttons.

A product photo studio: upload a product photo, describe the scene, and get the product placed in that scene (send the photo as the reference image).

A short video maker: a prompt, a 9:16 or 16:9 choice and a video model picker; show progress while the clip renders, then play it.

A voiceover tool: paste a script, pick a voice, and play or download the audio.

Compare prices per image on image API pricing and per second on video API pricing, or read the full API reference. The same three steps work in Replit, Bolt, v0 and Cursor, and every other place GenMagic works is on the integrations page.

Questions

About GenMagic in Lovable

Can an app built with Lovable generate AI videos?

Yes. Paste the prompt on this page into Lovable and it builds the server code that starts a clip with any of GenMagic's 33 video models (Veo, Kling, Seedance, Wan, Hailuo and others) and waits for it to finish. A clip usually takes one to three minutes.

Where does my API key go?

In Lovable, open Cloud, then Secrets, and add a secret named GENMAGIC_API_KEY with your key. Lovable passes secrets only to your app's Edge Functions, never to the browser. The prompt keeps every GenMagic call in that server code.

What does it cost?

Adding it is free. Every image, clip or voiceover your app makes is paid from one prepaid GenMagic balance at that model's price: an image on the default model (Google: Nano Banana 2.1) costs about $0.06, and a 4-second clip with sound on Google: Veo 3.1 Lite about $0.30. A new account gets a one-time $0.50 starter balance.

Who pays for what my users generate?

Your GenMagic balance does. Each answer says what the call cost (the X-Cost-Cents header), so your app can show it, cap it per user or charge for it in your own plans.

Which models can my app use?

Any of the 65 image models and 33 video models, plus speech and music models, with the same key. The prompt has Lovable build a model picker from GenMagic's public model list, so new models show up without a code change.