GuidesHosting choices

Claude Code Router (ccr): install, configure and route models

Claude Code Router v3 as of November 2026: install with npm or the app, add providers, route Claude Code to other models, and what Anthropic supports.

November 22, 2026The Everpod team
The short answer

Claude Code Router (CCR, musistudio/claude-code-router, MIT) is a local gateway that sits between Claude Code and the model provider, so Claude Code’s requests can go to DeepSeek, Gemini, OpenRouter, Kimi or any OpenAI- or Anthropic-compatible endpoint, with rules deciding which model gets which request. As of November 2026 it is version 3.1.6, a desktop app or npm install -g @musistudio/claude-code-router (Node 22 or newer), configured in a web UI at http://127.0.0.1:3458 that you open with ccr ui; the gateway itself listens on port 3456. You add a provider, create a Claude Code profile, and launch Claude Code with ccr "<profile name>". The config.json and ccr code in most tutorials are the 1.x and 2.x setup, which version 3 replaced. Anthropic does not support Claude Code on non-Claude models through any gateway.

What it is in November 2026

CCR started in June 2025 as an npm package described as a way to “Use Claude Code without an Anthropics account and route it to another LLM provider”. Version 3.0.0 (July 2026) turned it into what its README now calls “a local model gateway and control plane for coding agents”: one local endpoint for Claude Code, Codex, OpenCode, Pi, Kimi CLI, Grok CLI and others, with providers, keys, routing rules, request logs and cost estimates managed in one UI. The current release is 3.1.6, published November 21, 2026. The repository has about 38,000 stars and over 900 open issues.

It speaks five provider protocols, detected when you add a provider: OpenAI Chat, OpenAI Responses, Anthropic Messages, Gemini Generate and Gemini Interactions. The README names OpenRouter, DeepSeek, SiliconFlow, Moonshot, Kimi Code, Mistral, Z.AI and Bailian as presets, and anything else compatible goes in as a custom endpoint. A provider can hold several keys with priority, weight and limits.

Old tutorials against version 3

Most tutorials online describe the 1.x line (last release 1.0.73, December 2025) or 2.0.0. The 2.0.0 README and the current CLI reference differ on almost every point:

1.x and 2.0.03.x
Configuration
~/.claude-code-router/config.json, edited by handconfig.sqlite in the same folder, edited in the UI
Start Claude Code
ccr codeccr "<profile>", or a profile set as the system default
Routing
A Router block: default, background, think, longContext (over 60,000 tokens by default), webSearch, imageA profile model with per-tier overrides, plus ordered rules and fallback chains
Switch model in a session
/model provider_name,model_name/model, listing the models CCR exposes
Shell setup
eval "$(ccr activate)"Not in the current reference

The current CLI reference lists no ccr code. If a tutorial’s JSON does nothing, check ccr --help: you are almost certainly on 3.x. No migration guide from config.json is published.

Install and start it

The desktop app (.dmg or .zip for macOS, .exe for Windows, .AppImage for Linux) is on the latest release and is what the project recommends on a desktop. On a server, or if you prefer a terminal, use the npm CLI, which needs Node.js 22 or newer:

node --version
npm install -g @musistudio/claude-code-router@latest
ccr ui
Copied

ccr ui starts a background service and opens the browser; ccr start does the same without the browser and prints the management URL, and ccr stop ends it. That URL carries the management token in a ccr_web_token parameter, so treat the whole URL as a password. The token changes on each start unless you fix it with CCR_WEB_AUTH_TOKEN. Everything lives in ~/.claude-code-router (%APPDATA%\claude-code-router on Windows), and npm uninstall -g leaves it in place.

On a headless machine, the install guide suggests ccr ui --no-open, or ccr serve --no-open under a process supervisor such as a systemd unit, since serve stays in the foreground. Both ports bind to 127.0.0.1 by default, which is right: Claude Code on the same machine reaches the gateway, and you reach the UI from your laptop through an SSH tunnel rather than by opening a port:

ssh -L 3458:127.0.0.1:3458 you@your-server
Copied

then open the management URL with 127.0.0.1:3458 in your laptop’s browser. Installing Claude Code itself on the server is covered in Claude Code on Linux.

Add a provider and a Claude Code profile

  1. Providers > Add Provider. Pick a preset or Other / custom API endpoint, paste the key, and run Check Connection; CCR detects the protocol and the models.
  2. Agent Config > Add Profile > Claude Code. Name it, choose a Model, and optionally a model per tier (Fable, Opus, Sonnet, Haiku, the last one covering Claude Code’s small background requests). A tier left empty stays Claude Code’s choice.
  3. Scope. Only opened from CCR (the default) changes only sessions you launch through CCR, so a plain claude still goes to Anthropic. System default makes the profile apply to Claude Code everywhere; only one profile can hold it. The docs advise staying on the first until the setup is stable.
  4. Launch and check. Run the profile, send a message, and look for the request in Request logs, which show the provider and model that actually answered.
ccr "My DeepSeek"                         # Claude Code through the profile
ccr "My DeepSeek" cli -- --model sonnet   # pass Claude Code's own flags after --
Copied

Entry mode decides whether the profile appears as a terminal command, a button for the Claude desktop app, or both.

How requests are routed

Per the routing page, CCR recognises Claude Code’s requests and sends main requests to the profile’s model, unless Claude Code asked for a model CCR knows, which wins. Subagents can be given their own model: when at least one model on the Models page has a description, CCR tells Claude Code to name one in a <CCR-SUBAGENT-MODEL>provider/model</CCR-SUBAGENT-MODEL> tag in the subagent’s prompt.

Custom rules are checked top to bottom and the first enabled match applies. A rule tests a field of the request’s headers or body and rewrites the request, usually setting request.body.model to a provider/model value; a rule can also be a Node.js function. Each rule, or the global default, can retry or fall back, saved in this shape:

{
  "mode": "model-chain",
  "models": ["Provider/backup-one", "Provider/backup-two"],
  "retryCount": 0
}
Copied

Retry repeats the same model on 408, 409, 429 and 5xx; Fallback targets moves down the list on any 4xx or 5xx. CCR honours Retry-After, otherwise backing off from one second up to 30.

Pointing Claude Code at CCR yourself

The launcher sets Claude Code up for you. To use CCR from a Claude Code it did not start (a cron job, another user, a container), point Claude Code’s documented gateway settings at the gateway port, with a client key made on CCR’s API Keys page (keys can expire and carry their own rate limits):

export ANTHROPIC_BASE_URL=http://127.0.0.1:3456
export ANTHROPIC_AUTH_TOKEN=<your CCR client key>
Copied

CCR’s docs do not say which header it reads the key from. ANTHROPIC_AUTH_TOKEN sends it as Authorization: Bearer and ANTHROPIC_API_KEY as x-api-key; Anthropic’s advice when you do not know is to start with the first, run this test, and switch on a 401:

curl -sS -w '\n%{http_code}\n' -X POST "$ANTHROPIC_BASE_URL/v1/messages" \
  -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "claude-sonnet-4-6", "max_tokens": 1, "messages": [{"role": "user", "content": "."}]}'
Copied

An error about an unknown model still proves the address and key work. In Claude Code, /status should then show an Anthropic base URL line with port 3456. For a job that does not read your shell profile, put the two variables in the env block of ~/.claude/settings.json instead. The Claude desktop app ignores these variables and has its own third-party inference setting; a CCR profile reaches the app through its App entry instead.

Keep the gateway private

A reachable CCR spends your provider keys for anyone who can send it a request. The server settings allow 0.0.0.0 only for deliberate remote access, “together with CCR client API keys, firewall/private-network controls, and TLS at a reverse proxy”. In Docker, the default publishes only the UI’s proxy on 127.0.0.1, and the project asks remote deployments to pin a long, strong management token. Version 3.1.4 (November 16, 2026) fixed the Docker setup handing the management token to unauthenticated clients, so a Docker install older than that should be upgraded. The desktop app’s Proxy mode, which intercepts HTTPS traffic, installs a CA certificate your system then trusts; the plain gateway needs none of that.

What Claude Code does on a model that is not Claude

Anthropic’s gateway page is direct: Anthropic “doesn’t endorse, maintain, or audit third-party gateway products, and doesn’t support routing Claude Code to non-Claude models through any gateway.” Claude Code still runs that way, unsupported, and these are the differences to expect:

When you do not need a router

CCR earns its place when you want several providers, per-request rules, fallbacks or one endpoint for several agents. For one provider that already serves Anthropic’s API, Claude Code’s own two variables do the job with nothing running in between. DeepSeek’s Claude Code page is one example:

export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=<your DeepSeek API Key>
Copied

and the same page sets ANTHROPIC_MODEL and the ANTHROPIC_DEFAULT_*_MODEL aliases to its own model names. OpenRouter works the same way and reaches many providers’ models with one key; the variables, the model aliases and what OpenRouter itself says will not work are in OpenRouter in Claude Code, Codex and OpenCode.

And if the point is to use GPT, Gemini or a local model every day, an agent built for any model may serve better than Claude Code on a backend it was not made for: the terminal agents besides Claude Code compares them, and OpenCode against Claude Code looks at the closest of them.

Run Claude Code on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.