claude-code-router Documentation

One local control plane for every AI agent: route across models, fuse new capabilities, orchestrate tools, and stay fully in control.

36,611 stars TypeScript TypeScript 1 file ยท ~1,369 tokens
RAW Doc

Why use Claude Code Router?

Claude Code Router (CCR) is a local model gateway and control plane for coding agents. It gives Claude Code, Claude Design, Codex, Grok CLI, Kimi CLI, Kilo Code, OpenCode, Pi, ZCode, WorkBuddy, and compatible API clients one stable local endpoint, while you manage the providers, models, accounts, routing rules, and tools behind it from one place.

Use CCR to:

  • Manage all agents and providers together instead of maintaining a separate model configuration for every client.
  • Switch providers or models without changing your workflow or repeatedly editing agent configuration files.
  • Keep requests running with retries, credential pools, key rotation, and ordered fallback models.
  • Add capabilities to existing models with Fusion vision, web search, MCP tools, and ToolHub.
  • See what actually happened through request logs, resolved routes, latency, token usage, cost estimates, and account status.

CCR supports OpenAI Chat / Responses, Anthropic Messages, Gemini Generate Content / Interactions, OpenRouter, DeepSeek, SiliconFlow, Moonshot, Kimi Code, Mistral, Z.AI, Bailian, and custom compatible providers.

Supported Agents

Quick Start

  1. Download Claude Code Router for macOS, Windows, or Linux, then launch the app.

  2. Open Providers โ†’ Add Provider. Choose a built-in preset or a custom endpoint, enter the API key, select the protocol and models, then save.

  3. Open Server and click Start. The local model gateway listens on http://127.0.0.1:3456 by default.

  4. Open Agent Config, choose Claude Code, Claude Design, Codex, Grok CLI, Kimi CLI, Kilo Code, OpenCode, Pi, ZCode, or WorkBuddy, select a model, and apply the profile.

  5. Start using your agent. Open Logs to confirm the resolved provider, model, status, tokens, latency, and errors.

Your agent is now connected to CCR. To add conditions, retries, request rewrites, or fallback models, open Routing.

CLI

The npm CLI requires Node.js 22 or newer. It starts the same gateway and a browser-based management UI without Electron:

sh
npm install @musistudio/claude-code-router
ccr ui

Open http://127.0.0.1:3458, then follow the same Providers โ†’ Server โ†’ Agent Profiles flow above. The model gateway remains at http://127.0.0.1:3456. See the CLI reference for service modes, authentication, and profile commands.

Docker

sh
docker compose up -d --build

Docker exposes the management UI and gateway routes through http://127.0.0.1:3458 by default. Read the Docker deployment guide before exposing CCR remotely.

Build desktop apps

Install Node.js 22+, then run npm ci.

Target Command Output
macOS local DMG/ZIP npm run build:app:mac release-local/
Windows local NSIS installer npm run build:app:win release-local/

Windows app packaging must run on Windows x64 because better-sqlite3 ships a native Electron module. The release workflow builds macOS on macOS runners and Windows on windows-latest when a v* tag is pushed.

How it works

text
Claude Code ยท Claude Design ยท Codex ยท Grok CLI ยท Kimi CLI ยท Kilo Code ยท OpenCode ยท Pi ยท ZCode ยท WorkBuddy ยท Compatible API clients
                              โ”‚
                              โ–ผ
                 Claude Code Router :3456
          Profiles ยท Routing ยท Credentials ยท Tools ยท Logs
                              โ”‚
                              โ–ผ
             Selected provider, model, and account

Core capabilities

Area Highlights
Agents Profiles for Claude Code, Claude Design, Codex, Grok CLI, Kimi CLI, Kilo Code, OpenCode, Pi, ZCode, and WorkBuddy; model overrides; scopes; environment settings; CLI and app launch entries; multi-instance workflows
Providers Presets and custom endpoints; protocol probing; model discovery; connectivity checks; local login import where supported; single keys and credential pools
Models & routing Searchable catalog; model descriptions for task selection; conditions on headers and bodies; prefixes; rewrites; retries; ordered fallbacks
Tools & extensions Fusion models; ToolHub; built-in browser automation; Chrome login-state import; wrapper and core gateway plugins; local routes and virtual models
Access & quotas Separate CCR client keys with expiration and local request, token, and image limits
Observability Request and response details; resolved provider, model, and credential; status; latency; tokens; estimated cost; tool calls; agent traces
AgentClaw Agent relay through Weixin iLink, WeCom, Slack, Discord, Telegram, LINE, Feishu, and DingTalk

Go deeper when you are ready

The complete documentation lives at ccrdesk.top.

Support & Sponsoring

Our Sponsors

License

This project is licensed under the MIT License.