# ImageRouter — how to use (mcp.ai)

Connect your ImageRouter account and use 8 tools for AI content generation straight from your AI agent. Connect with your own API key. Generate images, videos, and text with ImageRouter, inspect credits, validate normal API keys, and discover models. Management-key endpoints are excluded.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_imagerouter?ms=1787295720000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `imagerouter_create_chat_completion`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/imagerouter`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/imagerouter/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/imagerouter/create/chat/completion` — Create a non-streaming OpenAI-compatible chat completion with a paid text model. Call IMAGEROUTER_LIST_MODELS, IMAGEROUTER_GET_MODEL, and IMAGEROUTER_GET_CREDITS first to verify availability, context,
  - body: { model: string, tools?: object[], top_p?: number, messages: object[], max_tokens?: integer, temperature?: number, tool_choice?: string|object, response_format?: object, reasoning_effort?: string }
- `POST https://api.mcp.ai/api/imagerouter/create/response` — Create a non-streaming OpenAI Responses API result from plain text or structured multimodal input with a selected ImageRouter text model. Call IMAGEROUTER_LIST_MODELS and IMAGEROUTER_GET_CREDITS first
  - body: { text?: object, input: string|object[], model: string, tools?: object[], top_p?: number, reasoning?: object, temperature?: number, tool_choice?: string|object, instructions?: string, max_output_tokens?: integer }
- `POST https://api.mcp.ai/api/imagerouter/edit/image` — Transform or inpaint one or more existing images supplied as URLs or data URIs. Call IMAGEROUTER_LIST_MODELS and inspect the selected model first to verify image and optional mask input support, accep
  - body: { size?: string, masks?: string[], model: string, images: string[], prompt: string, quality?: string, output_format?: string, response_format?: string }
- `POST https://api.mcp.ai/api/imagerouter/generate/image` — Generate an image from a text prompt with a selected ImageRouter model. Call IMAGEROUTER_LIST_MODELS and inspect the selected model first because pricing, supported sizes and quality levels, and fundi
  - body: { size?: string, model: string, prompt: string, quality?: string, output_format?: string, response_format?: string }
- `POST https://api.mcp.ai/api/imagerouter/generate/video` — Generate a video from text and optional URL or data-URI image inputs. Call IMAGEROUTER_LIST_MODELS and inspect the selected model first because pricing, accepted modalities, quality levels, sizes, and
  - body: { size?: string, model: string, images?: string[], prompt: string, quality?: string, seconds?: integer, response_format?: string }
- `POST https://api.mcp.ai/api/imagerouter/get/credits` — Inspect remaining credits, cumulative usage, deposits, and optional per-key usage before making potentially paid generation calls.
  - body: { by_api_key?: boolean }
- `POST https://api.mcp.ai/api/imagerouter/get/model` — Get current capabilities, accepted parameters, and pricing for one exact ImageRouter model ID before generation.
  - body: { model_id: string }
- `POST https://api.mcp.ai/api/imagerouter/list/models` — Discover current ImageRouter model IDs, modalities, supported parameters, and pricing before generation. Filters may be combined. limit truncates results and cannot be continued; omit it for an exhaus
  - body: { free?: boolean, name?: string, sort?: string, limit?: integer, fields?: string, provider?: string, input_modality?: string, output_modality?: string }

## Example prompts
- "What can I do in ImageRouter?"
- "Show me a summary of my ImageRouter account"

## More
- Page: https://mcp.ai/imagerouter
- Agent spec (llms.txt): https://mcp.ai/imagerouter/llms.txt
- Postman collection: https://mcp.ai/imagerouter/postman.json
