The problem AnyRouter solves
The model landscape changes every week — new providers, new prices, new rate limits. Wiring each one into your stack by hand is wasted effort that breaks the moment something shifts. Every provider ships a slightly different SDK, auth scheme, and error shape, so the half-dozen models a serious app touches become a tax you pay forever.
Concretely, the pain shows up in four places:
- Integration sprawl — a new SDK, base URL, and auth header for every provider you add.
- Rate limits — a single 429 stalls an agent mid-task, with no automatic way out.
- Key fragility — one leaked or throttled key is a single point of failure for your whole app.
- No visibility — when a call fails you can't see which upstream, why, or what it cost.
AnyRouter collapses all four into one OpenAI- and Anthropic-compatible endpoint. You write against a single contract and treat models as interchangeable building blocks.
How a request flows
Every request enters one gateway, resolves to a ranked list of upstreams, and falls over automatically until one succeeds — your client never sees the retries.
flowchart LR
C["Your client / agent"] -->|"one base URL"| GW["AnyRouter gateway"]
GW --> R{"Resolve & rank<br/>upstreams"}
R -->|"try 1"| U1["Provider A"]
R -.->|"401 / 429 / 5xx"| U2["Provider B"]
R -.->|"fallback"| U3["Your BYOK key"]
U1 --> OK["Response"]
U2 --> OK
U3 --> OK
OK --> CWhen an upstream returns a 401, 429, or 5xx, the gateway transparently fails over to the next one. Here is the same flow as a single failed request recovering — the client only ever sees the final 200:
sequenceDiagram participant C as Client participant GW as AnyRouter participant A as Provider A participant B as Provider B C->>GW: POST /v1/chat/completions GW->>A: try primary A-->>GW: 429 Too Many Requests Note over GW: quarantine A, fall over GW->>B: retry on next upstream B-->>GW: 200 OK + tokens GW-->>C: 200 OK (one response) Note over GW: every hop saved as a trace
Your agent finishes the task instead of dying mid-run — and every hop is recorded as a trace you can inspect.
The foundation it stands on
AnyRouter is not a thin proxy. It is built on a few opinionated foundations that make the routing trustworthy:
| Pillar | What it means | Why it matters |
|---|---|---|
| One contract | OpenAI- and Anthropic-compatible API over 150+ models | Swap models without touching client code |
| Never-fail routing | Auto-fallback and key pooling across providers | A single rate limit never stops your work |
| BYOK, untaxed | Bring your own keys and subscriptions — $0 platform fee | Using keys you already pay for costs nothing extra |
| Observability | Per-attempt traces: upstream, status, latency, tokens, cost | You can see exactly what happened on every call |
The BYOK pillar is the one you feel on your invoice. Most gateways take a cut of every dollar — a deposit fee plus a surcharge on your own keys at scale. On AnyRouter, using keys you already pay for is free:
Platform fee on $100 of BYOK traffic
Using your own provider keys — lower is better.
No tax on your keys. No cap.
≈5% on BYOK above ~1M requests/month.
Small top-ups carry an effective 8–16% deposit fee elsewhere.
Three words hold us to it: fast, honest, observable. The gateway earns trust by working first — then by showing its work.
Bring your own keys
Most gateways only resell their own credits — you top up a balance and spend it. AnyRouter does that too, but it also lets you bring the provider keys and paid subscriptions you already have and route them behind one resilient URL.
Add your provider keys once. AnyRouter spreads traffic across them and fails over between them when one hits a limit — turning a single key (a single point of failure) into a resilient pool. And BYOK traffic is never charged platform credits: you only ever pay your own providers; the gateway just routes.
- Pool multiple keys per provider for higher effective rate limits.
- Auto-quarantine a burned key on 401/429, with recovery — the agent keeps going.
- Your secrets are encrypted at rest with a per-row salt; we don't log prompt or completion bodies unless you opt in per account.
Drop in, swap later
AnyRouter speaks the OpenAI, Anthropic, and Responses APIs you already use — across the CLI, the SDKs, and raw HTTP. Point your existing client at the base URL and change the model id; nothing else moves.
curl https://anyrouter.dev/api/v1/chat/completions \
-H "Authorization: Bearer $ANYROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-3.5-flash",
"messages": [{ "role": "user", "content": "Hi" }]
}'Whatever speaks OpenAI or Anthropic works: coding agents (Claude Code, Codex, Cursor, Cline, Aider), the Vercel AI SDK, the official OpenAI/Anthropic SDKs, LangChain, and the AnyRouter MCP server.
Try it from your side
Are you a human or an AI agent? Flip the toggle to see the exact contract for your side — the CLI command and SDK snippet for people, or the base URL, model-id shape, and a paste-ready prompt for agents.
npx @anyr/cli claudenpx @anyr/cli claude --model z-ai/glm-5.2npx @anyr/cli codex --model z-ai/glm-5.2 --effort highnpx @anyr/cli claude --hub frontend-engineeringGet started
Free $2 credit when you sign up — no card required. Use our credits, or connect your own keys, and point your existing client at our base URL. Or put Claude Code, Codex, or Cursor on the gateway in one command:
- Run npx @anyr/cli claude (or codex, cursor) to launch your agent through AnyRouter.
- Or set the base URL to https://anyrouter.dev/v1 in any OpenAI/Anthropic client and pass your AnyRouter key.
- Add your own provider keys for untaxed BYOK routing whenever you're ready.
Route your first request in 2 minutes
Free $2 credit when you sign up — no card required. Use our credits, or connect your own keys.
Start free