MCP Server
Connect Claude Code, Cursor, Codex, VS Code and other MCP clients to reAPI with your API key.
reAPI runs a remote Model Context Protocol server, so an AI agent can list models, submit image, video, audio and text tasks, and fetch results without you writing any integration code.
https://reapi.ai/api/mcp- Transport: Streamable HTTP, stateless, one JSON-RPC message per HTTP request (batch arrays are rejected).
- Auth: your reAPI API key as a Bearer token —
Authorization: Bearer YOUR_API_KEY. Create one under Dashboard → API Keys (Authentication). - Billing: the same as the HTTP API. Every
submit_taskcall is exactly onePOSTto the matching/api/v1endpoint and is billed the same way: a call that creates a task is charged for that task.
Clients that can only sign in with OAuth (no custom header field) cannot connect yet.
Connect a client
Claude Code
claude mcp add --transport http reapi https://reapi.ai/api/mcp \
--header "Authorization: Bearer YOUR_API_KEY"Cursor
Add to ~/.cursor/mcp.json (or .cursor/mcp.json in a project):
{
"mcpServers": {
"reapi": {
"url": "https://reapi.ai/api/mcp",
"headers": { "Authorization": "Bearer YOUR_API_KEY" }
}
}
}Codex CLI
Codex reads the key from an environment variable:
export REAPI_API_KEY=YOUR_API_KEY
codex mcp add reapi --url https://reapi.ai/api/mcp \
--bearer-token-env-var REAPI_API_KEYCodex saves the variable name, not the key, so start Codex from a terminal
where REAPI_API_KEY is set (for example, export it in your shell profile).
VS Code
Add to .vscode/mcp.json:
{
"servers": {
"reapi": {
"type": "http",
"url": "https://reapi.ai/api/mcp",
"headers": { "Authorization": "Bearer YOUR_API_KEY" }
}
}
}Any other client that supports remote Streamable HTTP servers with a custom
Authorization header works the same way.
Tools
| Tool | What it does | Charges credits |
|---|---|---|
list_models | Lists the model ids submit_task accepts. Optional endpoint: images, videos, audio or text. | No |
get_model_schema | Returns the JSON Schema of a model's request body. Rules JSON Schema cannot express (conditional requirements, cross-field limits, case-insensitive values) are enforced by the API and listed on each model's docs page. | No |
estimate_cost | Returns the credits a submit_task call with this model and input would charge, without submitting. Token-billed models may settle differently; the final charge is usage.credits on get_task. | No |
submit_task | Submits one task: model plus input (the request body from get_model_schema). Returns a task id. | Yes, for every call that creates a task |
get_task | Returns a task's status and output. Optional wait_seconds (0–50) waits on the server while the task is still processing. | No |
get_balance | Returns the credit balance of the key's account. | No |
submit_task is not idempotent. A retry creates and bills a second task, so
check get_task or get_balance before retrying a call whose result you did
not receive.
Typical flow
list_modelswithendpoint: "images".get_model_schemafor the model you picked.- Optionally
estimate_costto see the price first. submit_taskwithmodeland aninputthat matches the schema.get_taskwithwait_seconds: 50, repeated whilestatusis stillprocessing, then readoutput.
Generation runs asynchronously, exactly like the HTTP API: submit_task
returns as soon as the task is accepted and never waits for the result.
wait_seconds saves the agent from polling in a loop; a long video may still
need a few get_task calls. If a status check fails for a temporary reason
during the wait (rate limit, server error, timeout), get_task returns the
last processing snapshot instead of the error; call it again.
Midjourney inpainting can stop at status: "modal". Continue that same task
with submit_task, passing action: "modal" and its task_id in input
(see get_model_schema for midjourney). The call returns the original task
id rather than creating a new task.
Rules carried over from the HTTP API
- Media inputs (
image_urls,video_url,audio_urls, …) must be publichttp(s)URLs. Base64 anddata:URIs are rejected. - When the HTTP API answers, its response body is the tool result unchanged,
with the same error codes and
request_id. Errors raised before a request reaches it — an unknown model, invalid tool arguments, or a network failure — come back as a plain error message, and a rejected key or origin on the MCP endpoint itself is an HTTP error. - The per-user rate limit applies to MCP requests too, and at most 100 tasks can be processing at once per account — see limits for agents.
- Model ids and parameters are the ones on each model's docs page. New models
appear in
list_modelsas soon as they launch.