Claude Code Router (CCR): Install, Configure and Route Any Model
Install Claude Code Router 3.x, set routing rules, add DeepSeek, Kimi, GLM, Ollama or any OpenAI-compatible provider, and fix the common CCR errors.
Published Checked By RouterPlex13 min read
One API key for every model on RouterPlex: vendor list price, $0 top-up fee, from $5.
Create a keyOn this page
Claude Code Router (CCR) is an open-source local proxy that sends Claude Code requests to any model provider and picks a model per task. Install it with npm, add a provider in the CCR UI, set routing rules, then launch Claude Code through a CCR profile. RouterPlex is one provider option: one key for 60+ models at vendor list price.
Updated 10 November 2026: rewritten for CCR v3.1.3 (still the latest release on 10 November 2026), with routing rules, GLM and DeepSeek providers, and the UI token.
Checked 20 October 2026: the Claude Code Router repository, its releases (v3.1.3, released 9 October 2026), and the CCR docs. CCR ships often. If your UI looks different, read the release notes first.
What Claude Code Router does
Claude Code normally talks to one API. CCR puts a small gateway on your machine between Claude Code and the providers. Each request lands on that gateway, CCR checks your rules, and it forwards the request to the provider and model you picked.
That gives you four things in one place.
- Provider keys stored once, outside your shell history.
- A model choice per task, such as a cheap model for background work and a stronger one for planning.
- Retries and ordered fallbacks when a provider fails.
- Request logs with the resolved provider, model, tokens, and latency.
CCR also supports other agents through Agent Config. The current list includes Codex, OpenCode, Kimi CLI, Grok CLI, Kilo Code, and Pi.
| Route | Best for | Local gateway |
|---|---|---|
| Claude Code Router | Several providers, per-task rules, fallbacks, local models | Yes |
| Direct Anthropic-compatible gateway | One upstream that already serves the models you want | No |
Install the current Claude Code Router
The npm CLI needs Node.js 22 or newer. Install it, then open the UI.
node --versionnpm install -g @musistudio/claude-code-routerccr ui
On an SSH or headless machine, run ccr ui --no-open and open the printed URL through a secure tunnel.
The management UI prefers http://127.0.0.1:3458. The model gateway prefers http://127.0.0.1:3456. If a port is busy, CCR tries the next one and prints the real URL, so trust the printed URL.
Desktop installers for macOS (Apple Silicon and Intel), Windows, and Linux are on GitHub Releases. The desktop app and the npm CLI share one data directory.
Three service commands come up often.
ccr startruns the service in the background.ccr serveruns it in the foreground with startup logs.ccr stopstops the background service.
CCR 3.x: desktop app, profiles and config.sqlite
Live configuration now sits in a file called config.sqlite.
- macOS and Linux:
~/.claude-code-router/ config.sqlite - Windows:
%APPDATA%\claude-code-router\config.sqlite
The setup order in the UI is simple. Add a provider under Providers. Start the gateway under Server. Create a Claude Code profile under Agent Config. Then watch Logs.
Do not edit the SQLite file by hand. For a backup, use Settings, Export data, or stop both the CLI and the desktop app first. Copying a live SQLite file can save a half-written state.
A legacy config.json does not drive 3.x. If you follow an older tutorial that edits it, your changes will not show up in the running gateway.
The config.json structure (legacy, for older installs)
CCR 1.x and 2.x read ~/. It has two main blocks. Providers lists each upstream with its URL, key, and models. Router maps a task type to a provider,model pair. The short example below reads the key from an env var.
{"Providers": [{"name": "routerplex","api_base_url": "https://api.routerplex.com/v1/chat/completions","api_key": "$ROUTERPLEX_API_KEY","models": ["deepseek-v4.1-flash", "glm-5.3", "kimi-k3"]}],"Router": {"default": "routerplex,deepseek-v4.1-flash","think": "routerplex,kimi-k3","longContext": "routerplex,glm-5.3","longContextThreshold": 60000}}
Restart with ccr restart after each edit. Older builds also used an optional APIKEY to protect the gateway. Without it, the host is forced to 127.0.0.1. Some providers needed a transformer entry to adapt the request shape. In 3.x, the protocol picker does that job.
Claude Code Router routing rules
Legacy CCR routed by task type. CCR 3.x routes with ordered rules instead. Each rule checks a request header or body field, and the first enabled match rewrites the request, usually request.body.model.
| Task | Legacy Router key | How to do it in CCR 3.x | Example model |
|---|---|---|---|
| Everyday turns | default | The model set on the Claude Code Agent Config profile | deepseek-v4.1-flash |
| Background work | background | Conditional rule on the requested model | glm-5.3-flash |
| Planning and reasoning | think | Conditional rule, or /model mid-session | kimi-k3 |
| Long prompts | longContext plus longContextThreshold (60,000 tokens if unset) | Conditional rule on a body field | glm-5.3 |
| Web search | webSearch | Conditional rule to a model that supports search | Your provider's search model |
| Images | not in the original README | contains deep check on messages for image, routed to a vision model | qwen3.8-max |
The example IDs are RouterPlex catalog IDs. Swap in your own provider's IDs.
Failures follow Default on failure. Retry mode retries the same model on 408, 409, 429, and 5xx. Fallback mode tries your listed models in order on any 4xx or 5xx. A rule's own fallback overrides the global one.
Routing Claude Code Router to specific backends
Every upstream in CCR is a provider with three things: a protocol, a base URL, and a list of model IDs. In the UI, open Providers, click Add Provider, pick a preset or Other / custom API endpoint, and paste the key. CCR detects the protocol. If it guesses wrong, turn detection off under Advanced settings and pick one of OpenAI Chat, OpenAI Responses, Anthropic Messages, Gemini Generate, or Gemini Interactions. Click Check Connection before saving. The check sends a real request, so select only the models you need.
| Backend | Protocol | Base URL | Example model IDs |
|---|---|---|---|
| DeepSeek | OpenAI Chat | https:/ | deepseek-flash, deepseek-v4-pro |
| Kimi (Moonshot) | OpenAI Chat | https:/ | kimi-k3, kimi-k2.6 |
| Z.ai GLM | OpenAI Chat | https:/ | glm-5.3 |
| Ollama (local) | OpenAI Chat | http:/ | Tags you have pulled |
| OpenRouter | OpenAI Chat | https:/ | OpenRouter slugs |
| RouterPlex | OpenAI Chat | https:/ | Any ID from /models |
Base URLs and model IDs checked 20 October 2026 on each vendor's API docs.
Claude Code Router with DeepSeek
Use the OpenAI Chat protocol with https:/. DeepSeek also offers an Anthropic-format endpoint at https:/. Per the DeepSeek API docs (checked 20 October 2026), deepseek-flash is now served by V4.1 Flash. The old deepseek-v4-flash name still works but points at a retired model.
Claude Code Router with Kimi
Kimi K3 suits repository-scale work because of its 1M-token context. Point an OpenAI Chat provider at https:/ and add kimi-k3. See Kimi K3 API pricing and setup for current rates before you hand it an agent loop.
Claude Code Router with GLM (Z.ai and Zhipu)
Create a custom provider named Z.ai with the OpenAI Chat protocol. The base URL is https:/, from the Z.ai quick start (checked 20 October 2026). Enter glm-5.3 as the model ID and run Check Connection. Z.ai Coding Plan keys use a separate endpoint, so follow Z.ai's Coding Plan guide for those.
On RouterPlex, GLM-5.3 costs $1.40 input and $4.40 output per 1M tokens. Cached input (prompt text the provider has seen before) costs $0.26. The smaller glm-5.3-flash costs $0.15 input and $0.50 output. Both prices come from the RouterPlex catalog, checked 20 October 2026.
Claude Code Router with Ollama
Point an OpenAI Chat provider at http:/ and add the model tags you have pulled. Local models have no per-token cost and no upstream budget to cap. They are usually weaker at long agent loops with many tool calls. A mixed setup works well: route private or simple turns to Ollama and send planning to a hosted model.
Claude Code Router with OpenRouter
Use OpenAI Chat with https:/ and OpenRouter's model slugs. OpenRouter adds a 5.5% fee on card credit purchases. See OpenRouter top-up fees for the dated breakdown and RouterPlex vs OpenRouter for the full comparison.
Claude Code Router with RouterPlex
RouterPlex gives CCR one key for 60+ models from DeepSeek, Kimi, Z.ai, Qwen, OpenAI, Anthropic, and others at vendor list price, with a $0 top-up fee. Create a dedicated key with a hard $5 or $10 budget first. CCR can retry and fall back, so the upstream key should hold the real spend limit.
- Open Providers and click Add Provider.
- Choose Other / custom API endpoint and name it
RouterPlex. - Choose the OpenAI Chat protocol and use
https:/./ api.routerplex.com/ v1 - Paste the dedicated RouterPlex key.
- Add exact IDs from the RouterPlex model catalog, such as
deepseek-v4.1-flashorglm-5.3. - Run Check Connection, then save.
Display names are not model IDs. "Claude Opus" will fail where claude-opus-4-8 works.
Create a CCR client key and Claude Code profile
CCR keeps two kinds of credentials apart. Your provider key, such as a RouterPlex key, pays for upstream calls. A CCR client key lets Claude Code call the local gateway. Do not paste one where the other belongs.
Open API Keys and create a client key. Then open Agent Config, click Add Profile, and choose Claude Code. Give it a name, pick a scope, and pick a model. Leaving the model blank keeps Claude Code's default.
Start with the scope Only opened from CCR. Only sessions you launch through CCR use the router, so nothing else on the machine changes. Switch to System default once the setup is stable.
Launch an enabled profile from the terminal like this.
ccr "Claude - RouterPlex" cliccr "Claude - RouterPlex" cli -- --model sonnet
Use the exact profile name or ID that CCR shows. Arguments for Claude Code go after --.
Switch models mid-session and per subagent
Inside a CCR-launched Claude Code session, type /model to list the models CCR exposes and switch between them. Legacy 1.x builds used / instead.
Subagents can pick their own model with a tag in their prompt.
<CCR-SUBAGENT-MODEL>routerplex/glm-5.3-flash</CCR-SUBAGENT-MODEL>
The current release reads this tag from the system prompt or the first two user messages and routes that Agent, Task, or Workflow call. It only lists models for subagents when at least one model has a Description filled in. Legacy builds wrote the tag with a comma, provider,model.
Verify the resolved route
Start in an empty directory with a read-only prompt. Before you give the agent a real repository, confirm both sides of the route.
- CCR Logs show the requested model, resolved provider, resolved model, status, tokens, and latency.
- Your provider dashboard shows the same model and a matching cost under the dedicated key.
- The key's budget drops by the billed amount.
- Stopping CCR makes the session fail, which proves Claude Code is not calling another endpoint.
Only then raise the budget or turn on fallbacks.
ccr code profile "code" was not found or is disabled
This is the exact CCR error that shows up when the profile name passed to ccr does not match an enabled Agent Config profile. A generic name such as code only works if you created a profile with that exact name.
Open Agent Config, copy the exact profile name or ID, enable the profile, then rerun it by name.
ccr "That Exact Name" cli
If the UI shows the profile as disabled, enable it before the CLI launch. Do not invent a code profile just to match an old tutorial.
no available models. configure at least one provider with a model before starting ccr gateway
CCR will not start the local gateway until at least one provider has a model ID. Add a provider, paste a real catalog ID such as claude-sonnet-4-6 or gpt-5.6-luna, run the connection check, then start the gateway.
A provider with a name and a key but an empty model list still produces this error. Display labels are not model IDs.
Set or reset the Claude Code Router web UI password
CCR 3.x has no web_ui_password or admin_password setting in its CLI or Docker docs (checked 20 October 2026). A management token protects the UI and its RPC calls instead.
- By default, CCR makes a random token on every start.
ccr uiopens the signed-in URL, andccr ui --no-openprints it. - For a fixed token, set
CCR_WEB_AUTH_TOKENto a long random value before you start CCR. Use this for Docker and any persistent server. - To reset access, run
ccr stop, set a newCCR_WEB_AUTH_TOKEN(or unset it to go back to random), then runccr start.
ccr stopexport CCR_WEB_AUTH_TOKEN="$(openssl rand -hex 32)"ccr start --no-open
In Docker, the sign-in URL looks like http:/. Guard that URL like a password. The management token is separate from CCR client keys, which only authorize model requests.
Common Claude Code Router problems
ccr is not found
Confirm Node.js 22 or newer, run npm prefix -g, and make sure npm's global binary directory is on PATH.
The UI opens but model calls fail
Check that a provider has a model, create a CCR client key, and confirm the gateway is running under Server. Run ccr serve in the foreground when you need startup logs.
Old settings keep returning
Run ccr stop before changing listener options. Edits to a legacy config.json do not change the live SQLite configuration.
The provider rejects the model
Check the base URL, the exact model ID, and which credential is in use. A model not found error means the ID differs between the provider's model list, your routing rule, and the Agent Config. A 401 or 403 means the provider key, base URL, or protocol is wrong.
The local gateway is exposed remotely
Keep CCR on 127.0.0.1 unless remote access is intentional. A remote deployment needs a fixed strong CCR_WEB_AUTH_TOKEN, TLS, firewall or private-network controls, and protected storage, because CCR holds your upstream keys.
Claude Code Router in Docker
Publish only the Nginx container port 8080, mapped as 127.0.0.1:3458:8080. Ports 3459 and 3456 are internal. The default 3458:8080 mapping listens on every host interface, so add the 127.0.0.1 prefix yourself.
Claude Code Router with VS Code
The VS Code extension follows the CCR route when it inherits the CCR environment. If it still reaches Anthropic directly, relaunch the editor from a shell where the CCR profile is active. You can also switch the profile scope to System default, then confirm in the logs.
Skip CCR when one gateway is enough
Claude Code can talk to an Anthropic-compatible gateway directly. Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, and there is no local proxy to run. RouterPlex serves that route at https:/ for its chat models, including non-Anthropic ones that the gateway translates. The setup lives in Claude Code with RouterPlex.
Choose CCR when you want local policy: several providers, per-task rules, fallbacks, or Ollama next to hosted models.
Cost controls for coding agents
- Route cheap work to a cheap model. The cheapest models ranking orders the catalog by what a real agent turn costs.
- Give every coding tool or repository its own key.
- Set a hard upstream budget before you enable retries or fallbacks.
- Start with one model and one profile.
- Compare CCR's cost estimate with the amount the provider billed.
- Rotate any key that shows up in shell history, logs, screenshots, or a commit.
A RouterPlex balance is prepaid and stops at $0, so a runaway loop cannot run up a debt. Try it with $1 of test credit, no card, cap the key, and route one small CCR request before you trust a long session.
Frequently asked questions
What is Claude Code Router?
How do I install Claude Code Router?
Does current Claude Code Router use config.json?
Can Claude Code use a custom API base URL without CCR?
Why does CCR say the code profile was not found or is disabled?
Which budget should I use for Claude Code?
Can Claude Code Router use Ollama?
Does Claude Code Router work with the VS Code extension?
Can I run Claude Code Router in Docker?
How do I set the Claude Code Router UI password?
Can Claude Code Router use GLM or Zhipu?
Run the smallest paid test.
Add $5, cap the key, and verify the result with your own workload. No subscription, and credit never expires. A first top-up of $25+ is matched with $25 extra.





