AnyRouter
All posts

June 22, 2026

Introducing AnyRouter

One OpenAI-compatible URL that reaches every major model, with automatic failover so a single rate limit never stops your work.

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 --> C
One contract in; automatic failover across upstreams until one succeeds.

When 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
A 429 on the primary upstream never reaches your client — the gateway retries the next one and records every hop.

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:

PillarWhat it meansWhy it matters
One contractOpenAI- and Anthropic-compatible API over 150+ modelsSwap models without touching client code
Never-fail routingAuto-fallback and key pooling across providersA single rate limit never stops your work
BYOK, untaxedBring your own keys and subscriptions — $0 platform feeUsing keys you already pay for costs nothing extra
ObservabilityPer-attempt traces: upstream, status, latency, tokens, costYou 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.

AnyRouter$0

No tax on your keys. No cap.

Typical gateway (BYOK surcharge)~$5

≈5% on BYOK above ~1M requests/month.

…plus deposit fee on a $20 top-upup to ~16%

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.

bash
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.

Launch Claude Code — no setupChạy Claude Code — không cần cấu hình
npx @anyr/cli claude
Pick any model (e.g. GLM-5.2)Chọn model bất kỳ (vd. GLM-5.2)
npx @anyr/cli claude --model z-ai/glm-5.2
One key works for Codex tooMột key dùng được cho cả Codex
npx @anyr/cli codex --model z-ai/glm-5.2 --effort high
Load a shared skill hubTải một skill hub dùng chung
npx @anyr/cli claude --hub frontend-engineering

Get 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:

  1. Run npx @anyr/cli claude (or codex, cursor) to launch your agent through AnyRouter.
  2. Or set the base URL to https://anyrouter.dev/v1 in any OpenAI/Anthropic client and pass your AnyRouter key.
  3. 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