Repolode
musistudio

musistudio/claude-code-router

A local model gateway that lets Claude Code, Codex, OpenCode and other coding agents share one endpoint and route requests across multiple model providers.

Stars
37,751
Forks
3,168
Open issues
1,150
Last commit
10 days ago

What is it?

Claude Code Router (CCR) runs locally and exposes one stable endpoint that coding agents such as Claude Code, Codex, Grok CLI, Kimi CLI, OpenCode and Pi can connect to. Providers, models, accounts and routing rules are managed in one place, so each agent does not need its own model configuration.

Requests can be routed by conditions on headers and bodies, rewritten, retried, or sent to ordered fallback models, with credential pools and key rotation for keeping traffic running. The project supports OpenAI Chat and Responses, Anthropic Messages, Gemini, and many compatible providers such as OpenRouter, DeepSeek and Mistral.

A desktop app, a CLI with a browser-based management UI, and a Docker deployment are available. Request logs show the resolved provider, model, status, latency, token usage and estimated cost.

Key features

  • 01Provides one local endpoint for multiple coding agents and API clients.
  • 02Routes requests by conditions, prefixes and rewrites, with retries and ordered fallbacks.
  • 03Manages providers and accounts with credential pools and key rotation.
  • 04Logs resolved provider, model, latency, tokens and estimated cost for each request.
  • 05Offers a desktop app, npm CLI with web UI, and Docker deployment.

Use cases

  • Using Claude Code or Codex with a non-Anthropic or non-OpenAI model provider.
  • Failing over to backup models when a provider rate-limits or errors.
  • Sharing one set of provider keys across several coding agents on a developer machine.
  • Tracking token usage and cost across different coding agents.

Quick start

  1. 1

    Install the npm CLI (requires Node.js 22+)

    npm install -g @musistudio/claude-code-router
  2. 2

    Start the management UI

    ccr ui
  3. 3

    Open the UI, add a provider, start the Server, and apply an Agent Profile; the gateway runs at http://127.0.0.1:3456

Things to know

  • Requires your own API keys or provider accounts to route requests.
  • Remote Docker exposure needs careful security setup before use.

Topics

FAQ

What is claude-code-router?
A local model gateway that lets Claude Code, Codex, OpenCode and other coding agents share one endpoint and route requests across multiple model providers. Claude Code Router (CCR) runs locally and exposes one stable endpoint that coding agents such as Claude Code, Codex, Grok CLI, Kimi CLI, OpenCode and Pi can connect to. Providers, models, accounts and routing rules are managed in one place, so each agent does not need its own model configuration.
Is claude-code-router free to use? What license does it have?
claude-code-router is open source under the MIT license. Check the license terms before using it in commercial products.
Is claude-code-router still maintained?
Actively maintained. The last commit to claude-code-router was on Oct 10, 2026.
What can I use claude-code-router for?
Using Claude Code or Codex with a non-Anthropic or non-OpenAI model provider. Failing over to backup models when a provider rate-limits or errors. Sharing one set of provider keys across several coding agents on a developer machine. Tracking token usage and cost across different coding agents.
How do I install claude-code-router?
Install the npm CLI (requires Node.js 22+): npm install -g @musistudio/claude-code-router Start the management UI: ccr ui Open the UI, add a provider, start the Server, and apply an Agent Profile; the gateway runs at http://127.0.0.1:3456
Where can I get claude-code-router?
The source code and installation instructions are on GitHub: https://github.com/musistudio/claude-code-router

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects