One endpoint for every model.
AnyRouter is an OpenAI- and Anthropic-compatible LLM gateway on Cloudflare. One API key reaches hundreds of models, with automatic failover, free models, bring-your-own-key at $0 markup, and a shared key Pool.
Quickstart
Change the base URL. Keep your code.
import OpenAI from "openai" const client = new OpenAI({ baseURL: "https://anyrouter.dev/api/v1", apiKey: process.env.ANYROUTER_API_KEY, }) await client.chat.completions.create({ model: "z-ai/glm-4.7-flash", messages: [{ role: "user", content: "Hello" }], })
Why it helps
Every model, one URL, resilient by default
One URL, every model
A single OpenAI- and Anthropic-compatible endpoint reaches hundreds of models across providers. Change the model id, not your code.
Failover and uptime
A 401, 429 or 5xx retries on the next upstream for that model, and continuous monitoring keeps the gateway answering when one provider does not.
Your keys, pooled
Pool your own provider keys and paid plans behind one gateway. BYOK never spends platform credit and carries no markup.
Transparent prices
Per-token pricing with one balance and one usage log, plus a curated set of free models on Go.
One key reaches every major provider
- OpenAI
- Anthropic
- Meta
- Mistral
- DeepSeek
- xAI
- Groq
- Qwen
- Cohere
- Z-AI
- Cloudflare
FAQ
Questions people ask
What is AnyRouter?
AnyRouter is an OpenAI- and Anthropic-compatible LLM gateway on Cloudflare. One API key reaches hundreds of models, with automatic failover, free models, bring-your-own-key at $0 markup, and a shared key Pool.
Who is AnyRouter for?
Developers who use more than one model provider, teams that want one bill and one usage log, and people who run coding agents such as Claude Code, Codex, or OpenCode and want to swap models without editing config.
Which APIs does it speak?
OpenAI Chat Completions, OpenAI Responses, OpenAI Embeddings, and Anthropic Messages. An OpenAI or Anthropic SDK works after you change the base URL and the key.
Is there a free tier?
Yes. The model id anyrouter/free routes to the best free model available at that moment and deducts no credits on Go and up. The Decisions API is also free on Go. The Free plan gets a 5-request trial on both.
Can I use my own provider keys?
Yes. Bring-your-own-key routes through the keys you already pay for with a $0 markup, so you pay your provider exactly what it charges. You can also donate a key to the shared Pool.
What happens when a provider fails?
On a 401, 429, or 5xx from one upstream, AnyRouter retries the request on the next upstream for that model. Your client sees the final answer.
Does AnyRouter store my prompts?
Request and response bodies are logged by default so you can debug real traffic in Request Logs. Turn off Body logging in Privacy settings to stop storing them. Provider keys are encrypted at rest.
Does it generate images or video?
No. The catalog covers text generation and embeddings only.