multi-router.aidocs

API Reference

Proxy Endpoints

The endpoints that Claude Proxies, Codex Proxies and Gemini Proxies serve to coding agents.

Proxy endpoints serve Claude Code, Claude Desktop, Codex CLI and Gemini CLI through a Claude Proxy, Codex Proxy or Gemini Proxy, in the format each tool sends. Each needs the inference scope and an x-mr-router header naming the proxy. A Claude Proxy serves each request on its route with the route's model id and key; a Codex Proxy and a Gemini Proxy forward it to OpenAI or Google as sent. See Claude Proxy, Codex Proxy, Gemini Proxy and Agents & Editors.

Claude Proxy

A Claude Proxy serves these endpoints:

EndpointFormatUse
POST /v1/messagesAnthropicRequests on the Anthropic route.
POST /v1/messages/count_tokensAnthropicToken counting at no cost, with its own rate limit of 300 per minute. Served only through a Claude Proxy.
POST /bedrock/model/{model}/invokeAmazon BedrockRequests on Bedrock routes.
POST /bedrock/model/{model}/invoke-with-response-streamAmazon BedrockStreaming requests on Bedrock routes.
POST /vertex/projects/{project}/locations/{location}/publishers/anthropic/models/{model}:rawPredictGoogle VertexRequests on Vertex routes.
POST /vertex/projects/{project}/locations/{location}/publishers/anthropic/models/{model}:streamRawPredictGoogle VertexStreaming requests on Vertex routes.
POST /vertex/projects/{project}/locations/{location}/publishers/anthropic/models/count-tokens:rawPredictGoogle VertexToken counting on Vertex routes.
GET /v1/modelsAnthropicThe models the proxy serves, with models:read.

On the Vertex endpoints, the project and location in the path come from the tool's settings, and on every endpoint the Claude Proxy serves the request from its own route, region and provider key.

Codex Proxy

A Codex Proxy serves this endpoint, for OpenAI models only:

EndpointFormatForwards to
POST /v1/responsesOpenAI ResponsesOpenAI

With an organization OpenAI key on the proxy, the client's OpenAI credential is replaced. Without one, the client's own OpenAI API key in Authorization is forwarded, and the Multi-Router key goes in X-MR-Api-Token. A WebSocket upgrade is refused with 400.

Gemini Proxy

A Gemini Proxy serves these endpoints, for Gemini models only, with the organization's Gemini key:

EndpointFormatForwards to
POST /v1beta/models/{model}:generateContentGeminiGoogle Gemini API
POST /v1beta/models/{model}:streamGenerateContent?alt=sseGemini, server-sent eventsGoogle Gemini API

The Multi-Router key can go in x-goog-api-key, as Gemini clients send their key. Errors from Multi-Router use Google's error format.

MessagesModels
Was this helpful?