Skip to main content

Generate Images & Video from Claude

Connect Claude to the FlyMyAI Agents MCP gateway once, and every chat becomes a media studio: ask for an image or a video clip in plain language, Claude picks the right FlyMyAI model, runs it under your key, and hands you a public URL. No SDK, no schema reading, no model shopping - the gateway tools do that for you.

This cookbook uses Claude as the example client, but the same flow works from any MCP client connected to the gateway - Cursor, Codex, Windsurf, ChatGPT.

1. Connect the gateway​

If you haven't connected yet, follow Connect your agent for every supported client. The short version:

claude mcp add --transport http flymyai https://mcp-agents.flymy.ai/mcp --header "X-API-Key: YOUR_KEY"

Get your key at app.flymy.ai/profile.

2. Just ask​

That's the whole workflow. In a Claude chat:

Generate a cinematic image of a lighthouse in a storm,
golden hour light, dramatic waves, 16:9.

Claude calls the gateway, generates the image, and replies with a public URL you can open, download, or paste anywhere. Follow-ups work the way you'd expect:

Make the sky more purple and add a small boat near the rocks.
Now animate it - slow push-in, waves crashing, 5 seconds.

You never name an endpoint or a parameter. If you have a favorite model, just say so ("use seedream for this one") - otherwise the gateway recommends one for the task.

3. What happens under the hood​

Each request runs a short discovery-then-generate chain of gateway tools:

StepToolWhat it does
1recommend_modelPicks the best FlyMyAI model for the task (text-to-image, image-to-image, text-to-video, image-to-video, and more). Returns ranked model_id candidates. Discovery step.
2get_model_schemaFetches the exact input parameters for the chosen model_id - prompt, aspect ratio, duration, source image, whatever that model accepts. Discovery step.
3run_modelRuns the model with those parameters. Returns the generated file with a public_url. This is the generation step, billed to your key.

So for the lighthouse prompt above, Claude asks recommend_model for a text-to-image model (it might rank models like nano-banana, seedream, flux, or imagen, for example), reads the winner's schema, then calls run_model with your prompt and a 16:9 aspect ratio.

For edits on an existing image, the Agents MCP media tools also include analyze_image - a VLM describes what is actually in the source frame before the edit prompt is written, so "make the sky more purple" edits the sky that is really there instead of a guessed one. See the Agents MCP tool reference for the public contract.

The catalog is live, not fixed

The gateway exposes its tools dynamically via tools/list, and recommend_model is the source of truth for which models exist right now. New models land continuously, so the same prompt can get a better model next month with zero changes on your side.

4. Video works the same way​

There is no separate video setup. The same recommend_model -> get_model_schema -> run_model chain handles video - the only difference is which models get recommended:

  • Text-to-video - "Generate a 5-second video of a paper plane flying through a neon city." recommend_model returns text-to-video candidates (models like veo or seedance, for example), and run_model returns a video URL.
  • Image-to-video - generate or pick an image first, then ask Claude to animate it. The public_url from the image run becomes the source-image parameter of an image-to-video model.
1. Generate a product shot of a matte black coffee grinder on a marble counter.
2. Great - now turn it into a short clip with slow rotating camera movement.

Step 2 reuses the image URL from step 1 automatically - you never copy anything between calls.

Chain as far as you like

Every run_model output is a URL, and URLs are valid inputs to the next model. Image -> edit -> upscale -> video is just four sentences in one chat.

5. Check the cost​

Billing is per-use with no subscription - each run_model call bills the real cost of that run. After a run, ask Claude:

How much did that video cost?

Claude calls get_execution_price and reports what that run used and costs; once billing_settled is true (usually within about 10 minutes) the amount is final. To compare prices before generating, get_pricing returns model pricing up front.

As a reference point from real bills: a short video clip lands roughly at $0.20-0.50 depending on the model. Images cost less.

Troubleshooting​

  • "API key missing" or auth errors - the gateway has no key to bill runs to. Grab your key at app.flymy.ai/profile and re-add the connector with the X-API-Key header (CLI clients), or sign in via OAuth (GUI clients).
  • Claude picked a model you don't want - name the model in your prompt ("use seedream") and Claude will run that one; otherwise recommend_model decides. If you're not sure what exists, ask Claude to list the candidates first.
  • Parameter error on a run - ask Claude to re-check the schema; get_model_schema for that model_id is always the source of truth for what arguments the model accepts.

Prefer the API directly?​

The gateway is the conversational front door. For programmatic generation in your own code - fixed model, fixed parameters, no LLM in the loop - call the Models API at api.flymy.ai directly:

Both surfaces use the same X-API-KEY and bill to the same account, so you can prototype in Claude and ship with the API.