reAPI MCP Server

Lets AI agents browse reAPI models, start image, video, audio or text jobs, and retrieve results from their MCP client.

Hosted MCP Server

npx add-mcp 'https://api.reapi.ai/api/mcp'

Installs into Claude Code, Codex, Cursor and more

Documentation

MCP Server (https://reapi.ai/docs/api/mcp)

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://api.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_task call is exactly one POST to the matching /api/v1 endpoint 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://api.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://api.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://api.reapi.ai/api/mcp \
  --bearer-token-env-var REAPI_API_KEY

Codex 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://api.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

ToolWhat it doesCharges credits
list_modelsLists the model ids submit_task accepts. Optional endpoint: images, videos, audio or text.No
get_model_schemaReturns 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_costReturns 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_taskSubmits 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_taskReturns a task's status and output. Optional wait_seconds (0–50) waits on the server while the task is still processing.No
get_balanceReturns 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

  1. list_models with endpoint: "images".
  2. get_model_schema for the model you picked.
  3. Optionally estimate_cost to see the price first.
  4. submit_task with model and an input that matches the schema.
  5. get_task with wait_seconds: 50, repeated while status is still processing, then read output.

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 public http(s) URLs. Base64 and data: 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_models as soon as they launch.