Base URL
The AnyRouter API endpoint is:
https://anyrouter.dev/api/v1All 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:
| Field | Type | Required | Notes |
|---|---|---|---|
| model | string | Yes | provider/model id |
| messages | array | Yes | Conversation history |
| temperature | number | No | 0–2, default 1 |
| max_tokens | integer | No | Max completion tokens |
| stream | boolean | No | Set true for SSE streaming |
| tools | array | No | Function/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 keyRelated posts
OpenRouter alternatives 2026: how AnyRouter differs
OpenRouter alternatives 2026, without invented rankings: AnyRouter is one OpenRouter alternative with $0-markup BYOK, a donated shared pool, a $2/mo Go plan, Cloudflare-edge routing, on-device models via local relay, a built-in MCP server, and open pricing config.
Run Claude Code on AnyRouter — wrapper script or CLI
Route Claude Code through AnyRouter in two ways: a wrapper that installs itself and maps Opus, Sonnet, and Haiku to one catalog model (override with --model), or the anyr CLI launcher. One key, unified billing, audit logs.