Claude Code Router: open-source claude-code-router vs CodeRouter
Two different things answer to "Claude Code router". claude-code-router (CCR) is a free, open-source project by musistudio: a gateway you run on your own machine, with your own provider keys and routing rules you write. CodeRouter — this site — is a hosted router: you point Claude Code at one URL, and it decides which model handles each request and bills you for it. If you came here looking for the open-source project, it is at github.com/musistudio/claude-code-router.
Side by side
| claude-code-router (musistudio) | CodeRouter | |
|---|---|---|
| What it is | Open-source (MIT) local model gateway and control plane for coding agents | Hosted routing service |
| Where it runs | Your machine or server: desktop app (macOS, Windows, Linux), npm CLI or Docker; gateway on 127.0.0.1:3456 by default | Our servers; Claude Code talks to https://www.coderouter.io |
| Model providers | You add providers and your own API keys — OpenAI, Anthropic, Gemini, OpenRouter, DeepSeek, Moonshot/Kimi, Z.AI and other compatible endpoints; key pools and rotation | No provider accounts: one CodeRouter key, one bill |
| Who picks the model | You do: a model per agent profile, plus rules that match request headers or body fields, rewrites, retries and ordered fallbacks — or a Node.js script. Claude Code subagents can pick from models you describe | CodeRouter, per request: a small judgment model reads the latest message and tool output and judges the coding phase, difficulty and whether the last turn failed; code picks the tier |
| Escalation | Fallbacks you configure (on errors) | A Claude Code session gets its tier at the start — Claude Haiku 5.5 for easy tasks, Claude Opus 5.5 for confident hard planning (pay as you go, Team), Claude Sonnet 5.5 otherwise — and moves up when a code change fails, or when the agent stops making progress (no source edit in the last 10 steps once the tier has served 15 steps on Haiku or 25 on Sonnet, or the same command three times) |
| Agents | Claude Code, Codex, Grok CLI, Kimi CLI, Kilo Code, OpenCode, Pi, ZCode, WorkBuddy, Claude Design | Claude Code, Cursor, Aider, Cline, Continue.dev, OpenClaw, the OpenAI SDK; GitHub Copilot via LiteLLM |
| Price | Free software; you pay each provider directly | Free trial ($5 of usage for 7 days); then pay as you go at model list price +8%, no monthly fee, smart routing or Direct mode; Team $19/developer + usage at list +8% |
| Teams | Separate client keys with expiry and local request, token and image limits | One key per engineer; budgets per member, project and company; 80% alerts; downgrade or pause at 100%; admins see spend, never prompts |
| Observability | Request logs with resolved provider and model, latency, tokens and estimated cost | Dashboard of cost per request; response headers such as X-CodeRouter-Model, X-CodeRouter-Tier and X-CodeRouter-Cost |
| Extras | Fusion vision, web search, MCP tools (ToolHub), browser automation, plugins, chat-app relays | Session stickiness so the prompt cache stays warm; a published benchmark |
| Your data | Requests go from your machine to the providers you configure | Requests pass through CodeRouter; a short excerpt is kept up to 180 days to improve routing (team admins can turn it off) — see the privacy policy |
Which one should you use?
Use claude-code-router if…
- You want everything local and free, and you already have accounts with the providers you want to use.
- You want to decide the routing yourself — which model handles which kind of request — and keep tuning it.
- You run several agents (Codex, OpenCode, Kimi CLI…) and want one local place to manage their models.
- You want its extensions: vision or web search added to models that lack them, MCP tools, plugins.
Use CodeRouter if…
- You don't want to write or maintain routing rules — the router decides per request and escalates on failure.
- You want one key and one bill instead of an account and a balance with every provider.
- You run a team and need spend per developer, budgets with alerts, and a downgrade instead of a hard stop — CodeRouter for Teams.
- You want nothing to install or keep running on each developer's machine.
Neither is right for a single developer who is happy on a flat Claude plan and stays within its limits — see Claude Code pricing for when a subscription is the better deal.
Set up Claude Code with CodeRouter
Claude Code speaks the Anthropic Messages API, and CodeRouter accepts it. Create a key in the dashboard (it starts with cr_ and is shown once), then:
- Use
ANTHROPIC_AUTH_TOKEN, notANTHROPIC_API_KEY. If Claude Code's header still shows your Claude subscription instead of API usage billing, runclaude logoutand start it again. ANTHROPIC_MODEL=autolets the router pick. In smart routing explicit model names are ignored; in Direct mode you name the exact model instead.- Each response carries
X-CodeRouter-Model,X-CodeRouter-TierandX-CodeRouter-Cost, so you can see what handled the request.
For comparison, getting claude-code-router running looks like this:
Then add providers and keys, start the server and apply a Claude Code profile in its UI — see its README and routing docs.
FAQ
Is CodeRouter the same as claude-code-router?
No. claude-code-router (CCR) is an open-source project by musistudio on GitHub: a local gateway you run yourself, with your own provider API keys and your own routing rules. CodeRouter is a hosted service run by a different team: you point Claude Code at https://www.coderouter.io and it chooses the model for each request. The two projects are not affiliated.
Is claude-code-router free?
Yes. claude-code-router is MIT-licensed and free to run as a desktop app, an npm CLI or in Docker. You pay the model providers you connect to it directly.
How do I use Claude Code with CodeRouter?
Set ANTHROPIC_BASE_URL=https://www.coderouter.io, ANTHROPIC_AUTH_TOKEN to your cr_ key (not ANTHROPIC_API_KEY) and ANTHROPIC_MODEL=auto, then start claude. If Claude Code still shows your Claude subscription instead of API usage billing, run claude logout and start it again.
Which one saves more money?
It depends on the rules you write and the providers you pick. With claude-code-router you pay providers at their own prices and decide which model gets which request. CodeRouter charges model list price +8% and decides per request; in TokenWatt's 176-task benchmark (TokenWatt is a measurement project from the same team as CodeRouter), routed requests solved 96–100% of tasks for 56–70% less than sending every request to Opus, across runs.
How CodeRouter's routing was measured: benchmark methodology and results (TokenWatt, a measurement project from the same team as CodeRouter).