Skip to content
FlowAPI

§ Connect an agent

Remote MCP server for image and video

FlowAPI runs a remote MCP server at https://useflowapi.com/mcp with 7 tools; it speaks Streamable HTTP, authenticates with your API key in an Authorization: Bearer header and charges exactly what the REST API charges.

Endpoint
MCP URLhttps://useflowapi.com/mcp
TransportStreamable HTTP
AuthAuthorization: Bearer $FLOWAPI_KEY
REST APIhttps://useflowapi.com/v1

§ Setup

Three steps, about two minutes.

Start with a test key: every tool works at $0 and generate returns a sample file, so you can wire up the agent before you top up.

  1. 01

    Create a key

    Sign in and create an API key in the console. Test keys never charge; live keys use your balance.

    Get API key
  2. 02

    Put it in your shell

    Export it as FLOWAPI_KEY in the shell you start the agent from. Keep it out of the URL: the server refuses keys in the query string.

    shell
    export FLOWAPI_KEY="flow_sk_test_…"
  3. 03

    Add the server to your agent

    Pick your client below and paste one command or config block.

§ Clients

One server, any MCP client.

Any client that supports remote Streamable HTTP servers and a custom Authorization header can connect.

Claude Code

one command in the terminal

Registers the remote server for Claude Code and sends your key as a header on every call.

Check

Run claude mcp list: the server shows as connected. Then ask Claude to list the models.

terminal
claude mcp add --transport http flowapi https://useflowapi.com/mcp \
  --header "Authorization: Bearer $FLOWAPI_KEY"

Codex

~/.codex/config.toml

Codex reads the bearer token from the environment variable, so the key never sits in the config file.

Check

Restart Codex and run /mcp: the server and its tools are listed.

config.toml
[mcp_servers.flowapi]
url = "https://useflowapi.com/mcp"
bearer_token_env_var = "FLOWAPI_KEY"

Cursor · MCP JSON

.cursor/mcp.json

The same JSON block works in Cursor, Windsurf and other clients that read an mcpServers config.

Check

Open the client's MCP settings: the server is green and shows its tools.

mcp.json
{
  "mcpServers": {
    "flowapi": {
      "url": "https://useflowapi.com/mcp",
      "headers": {
        "Authorization": "Bearer flow_sk_test_…"
      }
    }
  }
}

REST API

POST /v1/generations

Plain HTTP for scripts, backends and agents without MCP. POST /v1/generations returns a job id right away.

Check

Poll GET /v1/jobs/:id until the status is succeeded; the result file URLs are in the job.

POST /v1/generations
curl https://useflowapi.com/v1/generations \
  -H "Authorization: Bearer $FLOWAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"google/nano-banana-pro","input":{"type":"text","prompt":"A red bicycle leaning on a brick wall"},"parameters":{"resolution":"1K","n":1}}'
GET /v1/jobs/:id
curl https://useflowapi.com/v1/jobs/JOB_ID \
  -H "Authorization: Bearer $FLOWAPI_KEY"

§ MCP tools

7 tools. The agent does the polling.

generate waits up to 40 seconds. If the job is not done by then, the agent gets the job id and calls get_job later.

  • list_models

    Every model with its flat prices per spec.

  • get_model

    One model by id: prices, defaults and parameters.

  • quote

    Exact price of a request before you submit it. Never charges.

  • generate

    Submit an image or video job. Waits up to 40 seconds, then returns the job id.

  • get_job

    Status, result file URLs or error of a job.

  • get_balance

    Available balance and trial credit in USD.

  • upload_file

    Upload a reference file (base64, up to 20 MB) for a later job.

§ Try asking

Then just ask.

  • Quote a 1024×1024 product shot of a ceramic mug on concrete with the cheapest image model, then generate it.
  • Upload ./logo.png and put it on a plain white t-shirt mockup.
  • Turn https://example.com/hero.png into a 5-second slow push-in video, 16:9.

§ Troubleshooting

If something goes wrong.

  • 401 FLOW_UNAUTHORIZED

    The key is missing or wrong. Run echo $FLOWAPI_KEY in the shell you start the agent from, then restart the agent: it reads environment variables only at startup.

  • 402 FLOW_INSUFFICIENT_BALANCE

    The balance can't cover the quoted price. Top up in the console, or switch to a test key while you build.

  • The agent does not see the tools

    Check that the URL ends in /mcp and that your client supports remote HTTP servers. Clients that only launch local (stdio) servers cannot connect directly.

  • A video stays in processing

    generate hands back the job id after 40 seconds; the agent keeps calling get_job. If the job fails, its error says why and the charge is refunded.

FAQ

Does the FlowAPI MCP server support OAuth?
No. Not yet: authenticate with an API key in the Authorization: Bearer header.
Does generating through MCP cost the same as the API?
Yes. MCP tools call the same service, so prices, balance checks and refunds are identical.
What happens when a video takes longer than the tool call?
generate returns the job_id after 40 seconds, and get_job fetches the result when it is ready.

Give your agent images and video.

Create a key, paste one command, then just ask.