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 key

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.

RouteBest forLocal gateway
Claude Code RouterSeveral providers, per-task rules, fallbacks, local modelsYes
Direct Anthropic-compatible gatewayOne upstream that already serves the models you wantNo

Install the current Claude Code Router

The npm CLI needs Node.js 22 or newer. Install it, then open the UI.

bash
node --version
npm install -g @musistudio/claude-code-router
ccr 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 start runs the service in the background.
  • ccr serve runs it in the foreground with startup logs.
  • ccr stop stops 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 ~/.claude-code-router/config.json. 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.

json
{
"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.

TaskLegacy Router keyHow to do it in CCR 3.xExample model
Everyday turnsdefaultThe model set on the Claude Code Agent Config profiledeepseek-v4.1-flash
Background workbackgroundConditional rule on the requested modelglm-5.3-flash
Planning and reasoningthinkConditional rule, or /model mid-sessionkimi-k3
Long promptslongContext plus longContextThreshold (60,000 tokens if unset)Conditional rule on a body fieldglm-5.3
Web searchwebSearchConditional rule to a model that supports searchYour provider's search model
Imagesnot in the original READMEcontains deep check on messages for image, routed to a vision modelqwen3.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.

BackendProtocolBase URLExample model IDs
DeepSeekOpenAI Chathttps://api.deepseek.comdeepseek-flash, deepseek-v4-pro
Kimi (Moonshot)OpenAI Chathttps://api.moonshot.ai/v1kimi-k3, kimi-k2.6
Z.ai GLMOpenAI Chathttps://api.z.ai/api/paas/v4/glm-5.3
Ollama (local)OpenAI Chathttp://localhost:11434/v1Tags you have pulled
OpenRouterOpenAI Chathttps://openrouter.ai/api/v1OpenRouter slugs
RouterPlexOpenAI Chathttps://api.routerplex.com/v1Any 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://api.deepseek.com. DeepSeek also offers an Anthropic-format endpoint at https://api.deepseek.com/anthropic. 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://api.moonshot.ai/v1 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://api.z.ai/api/paas/v4/, 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://localhost:11434/v1 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://openrouter.ai/api/v1 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.

  1. Open Providers and click Add Provider.
  2. Choose Other / custom API endpoint and name it RouterPlex.
  3. Choose the OpenAI Chat protocol and use https://api.routerplex.com/v1.
  4. Paste the dedicated RouterPlex key.
  5. Add exact IDs from the RouterPlex model catalog, such as deepseek-v4.1-flash or glm-5.3.
  6. 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.

bash
ccr "Claude - RouterPlex" cli
ccr "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 /model provider_name,model_name instead.

Subagents can pick their own model with a tag in their prompt.

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

  1. CCR Logs show the requested model, resolved provider, resolved model, status, tokens, and latency.
  2. Your provider dashboard shows the same model and a matching cost under the dedicated key.
  3. The key's budget drops by the billed amount.
  4. 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.

bash
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 ui opens the signed-in URL, and ccr ui --no-open prints it.
  • For a fixed token, set CCR_WEB_AUTH_TOKEN to a long random value before you start CCR. Use this for Docker and any persistent server.
  • To reset access, run ccr stop, set a new CCR_WEB_AUTH_TOKEN (or unset it to go back to random), then run ccr start.
bash
ccr stop
export CCR_WEB_AUTH_TOKEN="$(openssl rand -hex 32)"
ccr start --no-open

In Docker, the sign-in URL looks like http://127.0.0.1:3458/?ccr_web_token=<token>. 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://api.routerplex.com 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?
Claude Code Router, or CCR, is an open-source local proxy from musistudio. It accepts requests from Claude Code and other coding agents on a local gateway, then sends each one to the provider and model you chose. Version 3.x adds a desktop and browser UI, provider presets, Agent Config profiles, conditional routing rules, retries, fallbacks, and request logs. Configuration lives in a local config.sqlite file. As of 10 November 2026 the current release is v3.1.3, published on GitHub on 9 October 2026.
How do I install Claude Code Router?
Install Node.js 22 or newer, then run npm install -g @musistudio/claude-code-router and start the UI with ccr ui. The UI opens at http://127.0.0.1:3458 and the model gateway listens on http://127.0.0.1:3456 unless those ports are busy. Desktop installers for macOS, Windows, and Linux are on the project's GitHub Releases page. The desktop app and the npm CLI share the same local data directory, so you can switch between them.
Does current Claude Code Router use config.json?
No. CCR 3.x keeps live configuration in config.sqlite, in ~/.claude-code-router on macOS and Linux or %APPDATA%\claude-code-router on Windows. A config.json with Providers and Router keys belongs to the older 1.x and 2.x releases. Edit providers and routing rules in the UI instead. Before a file backup, stop CCR or use Settings, Export data, because copying a live SQLite file can capture a half-written state.
Can Claude Code use a custom API base URL without CCR?
Yes. Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN when the upstream gateway speaks the Anthropic Messages API. Claude Code then sends every request there with no local proxy. That is the simpler path when one upstream covers the models you want. RouterPlex supports it at https://api.routerplex.com, and the full setup lives in the Claude Code with RouterPlex docs. Use CCR when you want local routing rules across several providers.
Why does CCR say the code profile was not found or is disabled?
The profile name passed to ccr does not match an enabled Agent Config profile. Many old tutorials use a profile called code, but CCR only knows the profiles you created. Open Agent Config, copy the exact profile name or ID, make sure the profile is enabled, then run ccr with that exact name in quotes, for example ccr "Claude - Work" cli. Agent arguments go after a double dash.
Which budget should I use for Claude Code?
Start with a dedicated upstream key capped at what you are willing to spend on the test, such as $5 or $10. CCR can retry and fall back to other models, so one task can make more upstream calls than you expect. A hard limit on the upstream key is the real safety net. Raise it only after you compare the CCR request logs with the provider's billed amount for a few real sessions.
Can Claude Code Router use Ollama?
Yes. Add a provider with the OpenAI Chat protocol and the local Ollama endpoint http://localhost:11434/v1, then add the model tags you have pulled. Local models have no per-token cost. They are usually weaker than hosted frontier models at long agent loops with many tool calls, so a mixed setup is common. Send private or simple work to Ollama and heavier reasoning to a hosted provider with a conditional rule.
Does Claude Code Router work with the VS Code extension?
Yes. CCR works at the API boundary, so the VS Code extension follows the same route as the terminal when it inherits the CCR environment. If it still calls Anthropic directly, the editor was probably started from a shell without that environment. Relaunch it from a shell where the CCR profile is active, or switch the Agent Config scope to System default once your setup is stable. Then confirm the route in Request logs.
Can I run Claude Code Router in Docker?
Yes. The project ships a Dockerfile and a compose setup. Only the Nginx container port 8080 should be published, mapped to host port 3458 and bound to 127.0.0.1. Set CCR_WEB_AUTH_TOKEN to a long fixed value for any persistent deployment. CCR holds your upstream provider keys, so never publish it on a public interface. For remote access, put it behind a VPN or a reverse proxy with its own access control.
How do I set the Claude Code Router UI password?
CCR 3.x has no web_ui_password or admin_password setting in its CLI or Docker documentation, checked 20 October 2026. The management UI is protected by a token instead. Set a fixed one with the CCR_WEB_AUTH_TOKEN environment variable before starting CCR. Without it, CCR generates a random token on each start and ccr ui opens the signed-in URL for you. To reset access, run ccr stop, set a new token, and start CCR again.
Can Claude Code Router use GLM or Zhipu?
Yes. Add a custom provider with the OpenAI Chat protocol and the Z.ai base URL https://api.z.ai/api/paas/v4/, paste a Z.ai API key, and add glm-5.3 as the model ID. Run Check Connection before saving. If you would rather not open a Z.ai account, RouterPlex serves glm-5.3 and glm-5.3-flash at vendor list price through the same OpenAI-compatible provider block as every other RouterPlex model.

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.