APIMODELSAPIMODELS
MCP · Codex / Claude Code plugin · image / video / speech / chat

Generate images and video right inside Claude Code, Codex, Cursor or Cherry Studio

apimodels-mcp is an MCP server. Install it and your AI client gains a set of tools for our image, video, chat and speech models, using the API key you already have. You describe what you want; the assistant writes the prompt, generates, looks at the result and regenerates with a better prompt — without leaving the chat window or memorising model names.

Fastest: the Codex / Claude Code plugin

Coding agents such as Codex and Claude Code are good at planning: scripts, shot lists, prompts, editing with ffmpeg. The apimodels plugin adds the step they cannot do — actually rendering the video, images and voice-over. It bundles this MCP server with a skill that tells the agent when to use it, how to pick a model, how long video takes and when to ask you before spending. Once installed, just ask in plain words; there is no need to name tools.

  1. 1. Sign in once

    Your browser opens apimodels.app; click Authorize. A dedicated key is created for this machine and stored locally — nothing to copy or paste — and every client (Codex, Claude Code, …) picks it up. The agent can run this step for you; you only click Authorize.

    npx -y apimodels-mcp login
  2. 2. Install the plugin

    Claude Code(2.1.275+):

    /plugin install apimodels --marketplace stimQQ/apimodels-mcp

    Codex (restart Codex afterwards):

    codex plugin marketplace add stimQQ/apimodels-mcp
    codex plugin add apimodels@apimodels

    Only have the Codex desktop app and no codex command? Replace codex with npx -y @openai/codex — it runs the official CLI on the fly and shares the desktop app's config.

  3. 3. Just ask

    For example "make a 5-second 16:9 video of a kitten slowly raising its head in morning light" or "plan a 20-second product video for this repo and render it shot by shot". Codex asks you to confirm calls that spend credits (video, image, speech); checking progress or the balance never asks.

The plugin and the MCP server need Node.js. If it is missing, install the plugin anyway and ask for something: the agent notices the tools are not loaded and, with your OK, installs the official Node.js for you (winget on Windows — click Yes once; Apple's installer on macOS — click Continue, then Install). Restart the agent afterwards.

Hosted server: no Node.js, one Authorize click

The same tools also run on our servers. Add this URL to your client; it asks you to sign in to apimodels.app and click Authorize, and you are done — no Node.js, no key to copy. Authorizing creates a dedicated key named “MCP · app · date”; delete it in the console to disconnect.

https://api.apimodels.app/mcp

Codex

# ~/.codex/config.toml
[mcp_servers.apimodels]
url = "https://api.apimodels.app/mcp"

# then, in a terminal:
codex mcp login apimodels

Claude Code

claude mcp add --transport http apimodels https://api.apimodels.app/mcp
# then in Claude Code: /mcp → apimodels → Authenticate

Cursor

{
  "mcpServers": {
    "apimodels": { "url": "https://api.apimodels.app/mcp" }
  }
}

Put this in ~/.cursor/mcp.json, then click Authenticate next to apimodels under Customize → MCPs. One-click install, screenshots of every step and the fix for the sign-in timeout (port 8787) are in the Cursor guide.

ChatGPT, Claude.ai and others

Add a custom connector (or remote MCP server) with the URL above, then sign in and authorize when asked.

Two differences from the local server: the hosted one cannot read files on your machine — the agent calls get_upload_url, uploads the file with curl and uses the URL it gets back (a local path is refused with that hint); and each call waits at most 50 seconds, handing back a task id for get_task if a video is still rendering. If you already have a key, you can also connect with an Authorization: Bearer sk_… header.

Install

You can also configure the server yourself. There is nothing to download — it runs on demand through npx. Either run the login command above once (then the env line in the configs below can go), or grab a key at Console → API Keys and put it in.

Claude Desktop

Settings → Developer → Edit Config, add this to claude_desktop_config.json, then restart.

{
  "mcpServers": {
    "apimodels": {
      "command": "npx",
      "args": ["-y", "apimodels-mcp"],
      "env": {
        "APIMODELS_API_KEY": "sk_your_key_here"
      }
    }
  }
}

Cursor

Add this to ~/.cursor/mcp.json (it then shows under Customize → MCPs). To skip Node.js, use the hosted server above; the step-by-step guide is at /docs/cursor.

{
  "mcpServers": {
    "apimodels": {
      "command": "npx",
      "args": ["-y", "apimodels-mcp"],
      "env": { "APIMODELS_API_KEY": "sk_your_key_here" }
    }
  }
}

Codex CLI

Add this to ~/.codex/config.toml. Codex aborts a tool call after 60 seconds by default; the tools stay under that on their own (see "Long generations" below), so tool_timeout_sec is only needed if you want generate_video to return the URL in a single call.

[mcp_servers.apimodels]
command = "npx"
args = ["-y", "apimodels-mcp"]
env = { APIMODELS_API_KEY = "sk_your_key_here" }
# tool_timeout_sec = 660   # optional, see "Long generations" below

Cherry Studio

Settings → MCP Servers → add a new server of type stdio with the three fields below. Enable it, select it for the conversation from the MCP control under the chat box, and use a conversation model that supports tool calls (Claude, GPT, Gemini …).

Commandnpx
Arguments-y apimodels-mcp
Environment variablesAPIMODELS_API_KEY=sk_your_key_here

Any other MCP client works the same way — run this over stdio.

APIMODELS_API_KEY=sk_your_key_here npx -y apimodels-mcp

npx needs Node.js on your machine. On Windows install it from nodejs.org — Cherry Studio relies on it to launch the MCP server too.

What the server exposes

ToolWhat it does
get_balanceYour account balance in USD — the agent checks it before a batch.
list_modelsList available model ids (chat / image / video / audio).
chatChat or completion with any LLM (gpt-6.1-sol, claude-opus-5-5, gemini-3-pro-preview, …).
generate_imageText-to-image or image edit; returns the image URL(s) plus a downscaled preview the model can look at.
review_imageA vision model critiques an image against your brief and returns what matches, what is wrong and a revised prompt.
generate_videoText-to-video (optional reference image); returns the video URL(s), or a task id if it is not done within wait_seconds.
get_upload_urlHosted server only: a 15-minute link to curl -T a local file to; returns its public URL.
get_taskWait for or check on a running image / video / speech task; returns the URL(s), with a preview for image tasks.
text_to_speechText-to-speech (MiniMax voices); returns the audio URL.

ElevenLabs TTS is not exposed here: it streams raw audio bytes from POST /v1/tts/stream rather than returning a URL. Use the audio API directly for it.

Let the model check its own work

You can say "make a 16:9 banner that says SAVE 10%, check the spelling and fix it if it is wrong" and let the assistant iterate until it is right. It sees the result through one of two paths, and which one applies depends on your client:

Clients that hand the image to the model

Claude Desktop, Claude Code and Cursor pass tool-result images through to the model, so the preview that generate_image attaches (a JPEG up to 1024px) is genuinely visible to it and it corrects itself from what it sees. Pass return_image: false to skip the preview.

Clients that show the image only to you

Cherry Studio (verified on 1.9.11) renders tool-result images to you but sends the model a text placeholder, so the model is blind to what it just made. Use review_image there: it sends the image and your brief to a vision model and returns the critique as text — what matches, what is wrong, and a revised prompt. Same loop, and it works in every client.

Reviews default to gpt-5.6-luna and cost well under $0.01 each; pass claude-sonnet-5 for a stricter read. The conversation model itself only needs tool-calling support — Claude, GPT-5.x, gpt-6-astra and Gemini all qualify. You never fill in aspect ratio or resolution: the assistant picks them from what you asked for, so saying "16:9" is enough.

Local images just work

image_url on generate_image and generate_video accepts four forms: a public https:// URL, a local file path (/Users/me/photo.png, ./ref.jpg, ~/Pictures/x.webp), a URL on your own machine (http://127.0.0.1:8000/photo.png), and a data:image/png;base64,… URI.

The last three are uploaded for you first, and the resulting public URL is what gets generated from. That step has to happen on your side: the file exists only on your machine, and 127.0.0.1 means our server when our server resolves it — which is why passing one straight to the REST API fails with "private/reserved IP addresses not allowed". Uploads land in your account storage and are deleted after 30 days.

Long generations: nothing gets lost

Every generation on apimodels is an async task, and video is slow: a median of about 2.5 minutes, 9 in 10 within 8 minutes, on our production traffic for the week to 2026-09-22 (images take about 50 seconds). Meanwhile Codex aborts a tool call after 60 seconds by default, and the MCP SDK's own client timeout is 60 seconds too. A tool that blocks until the video is ready gets killed mid-wait: the task completes and is billed, but the assistant never sees the URL. That is what 0.2.x did.

Since 0.3.0 the generation tools wait at most wait_seconds (default 50) and then return the task id with a "still running" note; the assistant calls get_task, which waits up to another wait_seconds and returns the URL(s) — with the preview for image tasks — or "still running" again. Nothing is resubmitted and nothing is billed twice, and the assistant handles it by itself. Claude Code, Claude Desktop and Cursor have no 60-second limit, so wait_seconds: 600 on generate_video gets the URL in one call; APIMODELS_WAIT_SECONDS=600 in the server's env makes that the default.

Configuration

Env varDefaultDescription
APIMODELS_API_KEYoptionalYour sk_… key. Not needed after apimodels-mcp login; if both exist, this one wins.
APIMODELS_CREDENTIALS_FILE~/.apimodels/credentials.jsonWhere login stores the key and where the server reads it.
APIMODELS_BASE_URLhttps://api.apimodels.app/v1API base URL.
APIMODELS_WAIT_SECONDS50Default wait_seconds for generate_image / generate_video / text_to_speech / get_task: how long a call waits before handing back a task id (seconds, max 900).
APIMODELS_TIMEOUT_MS—Deprecated (0.2.x): the same wait in milliseconds; still honoured if set.

Common pitfalls

SymptomCause / fix
The tools never show up in the clientUsually npx cannot start — no Node.js on the machine, or the client did not inherit your PATH. Run the stdio command above in a terminal first and see what it prints.
A tool says No apimodels API key foundYou have not signed in yet. Run npx -y apimodels-mcp login and click Authorize in the browser; no client restart needed. The agent can run it for you.
The model says it cannot see the imageYour client is one of the "shows the image only to you" kind (Cherry Studio, for one). Use review_image instead, or switch to Claude Desktop / Cursor.
The assistant just talks and never calls a toolThe conversation model has no tool-calling support, or the server is not enabled for this conversation. Switch to Claude / GPT-5.x / Gemini and check the server is ticked under the chat box.
The tool call gets aborted mid-video (common in Codex)Upgrade to apimodels-mcp 0.3.0 or later: the generation tools wait at most wait_seconds (default 50) and then hand back a task id, and the assistant fetches the result with get_task — nothing is lost or billed twice. 0.2.x blocked for up to 5 minutes; when the client aborted, the URL was gone (the task still completed and was billed — find it under Console → Records).
private/reserved IP addresses not allowedYou passed a machine-local address straight to the REST API. Go through image_url on the MCP tools instead — they upload it for you first.

FAQ

Can I have Claude generate an image and then fix it by itself?

Yes. Install apimodels-mcp, then ask for the image in plain words. In Claude Desktop, Claude Code and Cursor the generated image is passed to the model, so it sees its own output and regenerates with a corrected prompt. In clients that show tool images only to the user, such as Cherry Studio, the review_image tool does the same loop in text: it sends the image and your brief to a vision model and returns what is wrong plus a revised prompt.

Is there a plugin for Codex or Claude Code?

Yes. Run "npx -y apimodels-mcp login" and click Authorize in the browser, then install the plugin: in Claude Code "/plugin install apimodels --marketplace stimQQ/apimodels-mcp"; in Codex "codex plugin marketplace add stimQQ/apimodels-mcp" followed by "codex plugin add apimodels@apimodels". The plugin bundles the MCP server with a skill that tells the agent when to use it, how to pick a model and when to ask before spending, so you can ask for a video in plain words without naming any tool.

Can I use it without installing Node.js?

Yes. Point your client at the hosted server, https://api.apimodels.app/mcp, and sign in when it asks: you log in to apimodels.app and click Authorize, which creates a dedicated key for that app. In Codex add the URL under [mcp_servers.apimodels] and run "codex mcp login apimodels"; in Claude Code run "claude mcp add --transport http apimodels https://api.apimodels.app/mcp" and authenticate from /mcp; in Cursor add it to ~/.cursor/mcp.json and click Authenticate (step-by-step guide at /docs/cursor); ChatGPT and Claude.ai take it as a custom connector. The hosted server cannot read local files, so the agent uploads them first with the get_upload_url tool.

Which clients does the apimodels MCP server work with?

Codex and Claude Code through the plugin; Claude Desktop, Cursor and Cherry Studio through the documented configs; and any other MCP client by running "npx -y apimodels-mcp" over stdio, after "npx -y apimodels-mcp login" or with APIMODELS_API_KEY in the environment. The conversation model needs tool-calling support: Claude, GPT-5.x, gpt-6-astra and Gemini all qualify.

Video takes minutes — will the tool call time out in Codex or Claude Code?

Not since apimodels-mcp 0.3.0. generate_video waits at most wait_seconds (default 50, under Codex's 60-second tool limit) and then returns a task id; the assistant calls get_task to collect the URL, repeating if the video is still rendering. Nothing is resubmitted or billed twice. Production video generation takes a median of about 2.5 minutes and 9 in 10 finish within 8 minutes, so expect one or two get_task calls. In Claude Code or Claude Desktop, which have no 60-second limit, pass wait_seconds: 600 to get the URL in one call.

What does it cost to use the MCP server?

The server itself is free and open source. You pay the normal per-generation price of whichever model the assistant calls, and only for successful generations. A review_image call costs well under $0.01 on the default gpt-5.6-luna.