FlexPic / Tutorials / Workflow and API
Use the API and the MCP server
Create an API key, check your balance, start a generation over REST and connect an MCP client such as Claude Code or Cursor to FlexPic.
Goal
Generate images, video and audio from a script or from an AI agent, using your own credits.
Before you start
- A signed-in account with credits.
- A terminal with
curl, or an MCP client that can send a customAuthorizationheader. - There is no CLI package and no OAuth sign-in. Access is by API key.
Steps
- Click your avatar to open the account menu and choose API keys. Type a name in Key name (for example "Laptop") and click Create key.
- When Copy your new key now appears, copy the key and store it in an environment variable. It is shown once, and you can have at most five active keys. A key looks like
fpk_live_followed by 32 characters. - Check your balance:
curl -s https://flexpic.ai/api/credits -H "Authorization: Bearer $FLEXPIC_API_KEY" - See which tools and models are live:
curl -s https://flexpic.ai/api/capabilities - Start an image generation. The answer contains a job id and the cost:
curl -s https://flexpic.ai/api/generate -H "Authorization: Bearer $FLEXPIC_API_KEY" -H "Content-Type: application/json" -d '{"slug":"create-image","tool":"Create Image","kind":"image","prompt":"a red kite over a quiet beach","out":{"ar":"1:1","res":"1k"},"n":1}' - Poll the job until its status is done:
curl -s https://flexpic.ai/api/jobs/JOB_ID -H "Authorization: Bearer $FLEXPIC_API_KEY" - To use MCP, add the server
https://flexpic.ai/mcpto your client and send the same header. For Claude Code:claude mcp add --transport http flexpic https://flexpic.ai/mcp --header "Authorization: Bearer $FLEXPIC_API_KEY" - Ask your agent to call
list_modelsandestimate_costfirst, thengenerate_image,generate_videoorgenerate_audio. Video returns a job id; usewait_for_jobuntil it is done.
What you should get
A finished job with signed result URLs that stay valid for about 24 hours, and credits deducted exactly as on the website. Failed jobs are refunded automatically.
Cost example
The API and MCP use the same prices as the app. The image request above costs about 8 credits with GPT Image 2.5 at Low quality, and a 5 second Seedance 2.0 video at 720p costs about 957. The estimate_cost tool returns the price without charging you.
Tips
- Treat the key like a password and never put it in a URL or a public repository.
- Each key allows 60 requests per minute and 10 started generations per minute. Over the limit you receive a 429 response with a Retry-After header.
- Reference image URLs must be public https links.
- The full reference, including client setup for Cursor and Codex, is in the repository file docs/API.md.
Common mistakes
- Looking for an OAuth sign-in. This server accepts API keys only, so a client that cannot send a custom header cannot connect.
- Losing the key. It cannot be recovered; revoke it and create a new one.
- Polling without limits. Use the wait tools or poll every few seconds.