Claude Code Router
A local gateway for Claude Code, Codex, OpenCode and other agents: pick model providers, route requests, set fallbacks and read logs
Install
npm install -g @musistudio/claude-code-router
ccr uiRequires Node.js 22 or newer. The UI is at http://127.0.0.1:3458, the gateway listens on port 3456.
This is third-party code. Review the repository files before installing.
What it does
CCR runs a single local endpoint that coding agents connect to, while you choose the providers and models behind it. Requests can be routed by conditions, rewritten, retried on failure and moved to a fallback model. It speaks the OpenAI, Anthropic and Gemini protocols and supports OpenRouter, DeepSeek, Moonshot, Mistral and custom compatible endpoints. The dashboard shows which provider and model served each request, token usage, latency and an estimated cost.
Who it is for. For developers who want to run Claude Code and similar agents on other providers' models or manage several keys in one place.
Good fit when
- You want Claude Code to use DeepSeek, Kimi or your own OpenAI-compatible server
- Several agents should share one set of keys and routing rules
- You need retries and fallback models when a provider fails
- You want to see token usage and the route of every request
Not a fit when
- You use one agent with its default provider
- Company policy forbids sending requests through a third-party gateway
Example request
Set up Claude Code to use DeepSeek and switch to another model when it failsLimitations
You need your own keys or subscriptions with model providers. Availability from Russia depends on the chosen provider, some do not work without a VPN. The CLI requires Node.js 22 or newer. Agent quality on third-party models may differ from the native model.
How to disable. Remove the CCR profile from the agent in Agent Config, stop the server, then run npm uninstall -g @musistudio/claude-code-router or uninstall the desktop app.
Security check
- Stores model provider API keys
- All agent traffic, including project code, goes through the gateway to the chosen providers
README in short
The README presents CCR as a local gateway and control panel for coding agents. The main install is a desktop app for macOS, Windows and Linux, with an npm package that serves a web UI and a Docker option. Setup goes step by step: add a provider, start the server, apply an agent profile, check the logs. Extras include credential pools, web search and MCP tools for models, client key quotas and relaying the agent to chat apps. MIT licensed.
FAQ
How does the desktop app differ from the CLI?
Both run the same gateway on port 3456. The CLI skips Electron and serves the management UI in the browser on port 3458.
Which agents can connect?
The README lists Claude Code, Codex, OpenCode, Kimi CLI, Grok CLI, Kilo Code, Pi and several apps, plus any client with a compatible API.
Related
Open-source personal AI assistant on your own machine: answers in Telegram, Slack, Discord and WhatsApp, extended with skills and plugins
A self-improving agent from Nous Research with a TUI, messaging gateway, cron jobs and skills it writes itself
Anthropic's coding agent for the terminal, IDE and GitHub: understands your codebase, runs tasks and handles git
OpenAI's coding agent that runs locally in your terminal, with IDE and desktop versions