Favicon of Claude Code Router

Claude Code Router

Local model gateway that lets Claude Code, Codex, Grok CLI, and ZCode route, fail over, and switch between AI providers from one control plane.

Claude Code Router website screenshot
Claude Code Router GitHub repository preview

Claude Code Router (CCR) is a local model gateway and control plane for AI coding agents. Instead of configuring each agent (Claude Code, Codex, Grok CLI, ZCode, or any compatible API client) with its own provider settings, CCR gives them all one stable local endpoint and lets you manage providers, models, routing rules, and tools in a single place. It's built for developers who use multiple coding agents or switch between model providers often and don't want to edit configuration files every time.

The project ships as a desktop app (macOS, Windows, Linux) and as an npm CLI with a browser-based management UI, plus a Docker deployment option. Under the hood it exposes a local gateway (default http://127.0.0.1:3456) that agents talk to, while CCR handles provider selection, credentials, retries, and logging behind the scenes.

Key features

  • Unified agent management: configure Claude Code, Codex, Grok CLI, and ZCode profiles from one app instead of separate config files per tool.
  • Provider flexibility: supports OpenAI Chat/Responses, Anthropic Messages, Gemini, OpenRouter, DeepSeek, SiliconFlow, Moonshot, Kimi Code, Mistral, Z.AI, Bailian, and custom compatible endpoints.
  • Routing and failover: define conditions on headers/bodies, prefixes, rewrites, retries, and ordered fallback models so requests keep running when a provider fails.
  • Credential pools and key rotation: manage multiple accounts and API keys per provider, with local login import where supported.
  • Fusion and tooling: add capabilities to existing models via Fusion vision, web search, MCP tools, ToolHub, and built-in browser automation.
  • Observability: view request logs, resolved provider/model, latency, token usage, cost estimates, and account status from the dashboard.
  • Access control: issue separate CCR client keys with expiration and per-key request, token, or image limits.
  • Network tools: local HTTP/HTTPS proxy with optional CA, network capture, and bot relay to Slack, Discord, Telegram, WeCom, and other chat platforms.

Ideal use cases

CCR fits developers who run more than one AI coding agent and want a single place to swap models or providers without touching each tool's config. It's useful if you rely on multiple API keys or accounts and want automatic fallback when a provider rate-limits or goes down, or if you want visibility into what model actually served each request and at what cost.

It's also a good fit for teams that want to centralize provider credentials and set usage quotas for individual users or agents, rather than distributing raw API keys.

CCR is not the right tool if you only use a single agent with a single fixed provider and never need to switch, retry, or observe requests, since the extra local service adds overhead you won't use. It's also not a replacement for the agents themselves (Claude Code, Codex, etc.); it's a routing layer that sits in front of them, so you still need the underlying agent installed and running.

Installation

The recommended path is the desktop app:

  1. Download the release for macOS, Windows, or Linux from the GitHub releases page and launch it.
  2. Open Providers → Add Provider, pick a preset or custom endpoint, enter the API key, choose the protocol and models, and save.
  3. Open Server and click Start. The gateway listens on http://127.0.0.1:3456 by default.
  4. Open Agent Config, pick Claude Code, Codex, Grok CLI, or ZCode, select a model, and apply the profile.
  5. Use your agent normally, and check Logs to confirm the resolved provider, model, status, tokens, and latency.

For a CLI-only setup (requires Node.js 22+):

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

Then open http://127.0.0.1:3458 and follow the same Providers → Server → Agent Config flow. The gateway stays at http://127.0.0.1:3456.

For Docker:

docker compose up -d --build

This exposes the management UI and gateway routes through http://127.0.0.1:3458 by default. Configuration is stored in SQLite (~/.claude-code-router/config.sqlite on macOS/Linux, %APPDATA%\claude-code-router\config.sqlite on Windows), with a legacy config.json read once for migration if no SQLite config exists yet.

Frequently asked questions

Share:

Stars
36.2K
Forks
3K
Last commit
13 hours ago
Repository age
1 year
License
MIT
Self-hosted
No
Activity score
84/100
View Repository
Ad
Favicon

 

  
 

Similar to Claude Code Router

Favicon

 

  
 
Favicon

 

  
 
Favicon