Skip to content
GuidesAugust 5, 2026

AnyRouter API documentation: base URL, model ids, and request format

The AnyRouter API is OpenAI-compatible. Here's the base URL, model id format, authentication, and a working request example.

Base URL

The AnyRouter API endpoint is:

https://anyrouter.dev/api/v1

All standard OpenAI-compatible routes are under this prefix: /v1/chat/completions, /v1/embeddings, /v1/models, etc.

Authentication

Pass your API key in the standard Authorization header:

curl https://anyrouter.dev/api/v1/chat/completions \
  -H "Authorization: Bearer sk-ar-v1-placeholder" \
  -H "Content-Type: application/json" \
  -d '{"model":"anyrouter/free","messages":[{"role":"user","content":"Hi"}]}'

Keys start with sk-ar-v1-. Create one from the AnyRouter dashboard.

Model id format

Model ids follow the provider/model convention:

  • anthropic/claude-sonnet-4-5
  • openai/gpt-5.5
  • google/gemini-2.5-pro
  • z-ai/glm-5.2
  • anyrouter/free (shared pool free tier)

The provider prefix tells AnyRouter which upstream to route to. Omitting the prefix or using an unrecognized id returns a 404.

Request format

The request body follows the OpenAI Chat Completions schema. The most common fields:

FieldTypeRequiredNotes
modelstringYesprovider/model id
messagesarrayYesConversation history
temperaturenumberNo0–2, default 1
max_tokensintegerNoMax completion tokens
streambooleanNoSet true for SSE streaming
toolsarrayNoFunction/tool definitions

Streaming responses

Set stream: true to receive Server-Sent Events. AnyRouter forwards the upstream provider's streaming format directly. Handle the SSE stream the same way you would with the provider's native API.

Error responses

AnyRouter returns standard HTTP status codes:

  • 200 — success
  • 400 — malformed request body
  • 401 — invalid or missing API key
  • 404 — model not found or provider not configured
  • 429 — rate limit exceeded (see the 429 guide)
  • 500/502/503 — upstream provider error or gateway issue

Where to go from here

The full interactive API reference with every endpoint and schema is at docs.anyrouter.dev. For monitoring and debugging, use chmonitor.dev to inspect per-request traces including upstream, latency, tokens, and cost.

OpenAI-compatible API, $2 free credit, no card required.

Get your API key