# Repository Briefing: musistudio/claude-code-router
> Source: https://repoforai.com/repo/musistudio/claude-code-router (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/musistudio/claude-code-router
- **Official Docs / Website**: https://ccrdesk.top/
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: TypeScript
- **License**: MIT
- **Engineering Health**: A+ (98/100 · Maintenance 35/35 · Adoption 23/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v3.1.6 (2026-11-21) — https://github.com/musistudio/claude-code-router/releases
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: Docker, Self-Hosted, CLI, MCP, API
- **Momentum**: 38,472 ★ total (+8 24h / +101 7d) · 3,255 forks
- **When to Use**: Best for: Developers or teams running several supported coding agents who need to switch providers, configure fallback routes, and verify where requests went without maintaining separate routing configurations for each client. Skip if: One agent connects reliably to one provider, or your primary need is an offline inference server or a guarantee of native feature parity across providers.

## Overview
```text
### Architecture & Core Mechanics
Claude Code Router (CCR) is a local model gateway with a management UI. Agent profiles configure clients to use a stable endpoint. For each request, routing rules resolve the upstream provider, model, and account, allowing those choices to change without reconfiguring every agent. In the default desktop and CLI setup, the model gateway listens on port 3456; the CLI management UI is served separately on port 3458.

The TypeScript monorepo includes Electron desktop builds and a Node.js CLI that serves the web UI without Electron. The root manifest lists @the-next-ai/ai-gateway, undici, openai, and the native better-sqlite3 module. Wrapper and core gateway plugins, local routes, and virtual models provide extension points in the request path. Fusion, ToolHub, and MCP integration let the gateway add capabilities beyond forwarding model requests.

### Key Capabilities & Differentiators
CCR supports OpenAI Chat and Responses, Anthropic Messages, and Gemini Generate Content and Interactions, alongside provider presets such as OpenRouter, DeepSeek, and Moonshot and custom compatible endpoints. Provider configuration includes protocol probing, model discovery, connectivity checks, and credential pools. Routing can match headers or bodies, apply prefixes or rewrites, retry requests, and move through an ordered list of fallback models.

Agent profiles can apply model overrides and environment settings across clients such as Claude Code, Codex, and OpenCode. Separate CCR client keys can expire and enforce local request, token, and image limits. Logs show the resolved provider, model, and credential alongside status, latency, usage, estimated cost, and tool activity. Fusion vision, web search, and MCP tools extend the workflow, but protocol compatibility alone does not establish native feature parity across agents and providers.

### Trade-offs & Limitations
For one agent and one provider, direct configuration avoids an extra service, routing rules, and a separate credential store to manage. A generic API gateway is worth considering if the only requirement is a shared model endpoint. CCR is more compelling when agent-specific profiles, fallback policies, and centralized logs replace duplicated configuration across several clients. Validate fallback models against the actual client workflow: returning text through a compatible API does not prove that tool calls or native image features will behave the same way.

Retries and fallbacks can improve availability, but they may increase end-to-end latency and upstream usage. Local hosting gives you control over the routing layer; it does not make inference local, remove API charges, or prevent data from reaching an upstream provider. Treat provider credentials, client keys, and request and response logs as sensitive. Keep the loopback default unless remote access is needed and you can control who reaches the management interface.

### Hardware & Deployment Guide
Use the desktop app on macOS, Windows, or Linux for graphical setup. For a headless install, the npm CLI requires Node.js 22 or newer: install @musistudio/claude-code-router and run ccr ui, then open http://127.0.0.1:3458. Docker Compose instead serves management and gateway routes behind Nginx through the loopback mapping 127.0.0.1:3458:8080 and persists /data in the ccr-data volume. Internal listeners are not published by that Compose configuration, and the local gateway still needs connectivity to whichever upstream services you configure.

For desktop source builds, run npm ci under Node.js 22 or newer; Windows x64 packaging must run on Windows x64 because of the native better-sqlite3 Electron module. v3.1.4 fixed the Docker path that exposed the management token to unauthenticated clients. v3.1.5 addressed credential fallback and provider-qualified routing, among other fixes. v3.1.6 added provider balance and usage in Codex desktop and native image generation and editing through a configured Images API provider.
```

## Key Capabilities
```text
- Agent profiles: Apply model overrides, scopes, and environment settings to clients such as Claude Code, Codex, and OpenCode.
- Routing and failover: Match headers or bodies, rewrite requests, retry, and try fallback models in a configured order.
- Protocol coverage: Support OpenAI Chat and Responses, Anthropic Messages, and Gemini Generate Content and Interactions.
- Access and observability: Issue expiring client keys with local request, token, and image limits; inspect resolved routes, latency, usage, and estimated costs.
- Tool integration: Extend model workflows with Fusion vision, search, MCP tools, ToolHub, and gateway plugins.
- Container boundary: Compose publishes only Nginx at 127.0.0.1:3458 and persists the /data directory in a named volume.
```

## Quick Start / Clone
```bash
npm install -g @musistudio/claude-code-router@latest
ccr ui
```
