claude-code-router README

The project's README from github.com/musistudio/claude-code-router. As one markdown file: README.md.

Kimi K2.7 Code sponsor banner
Kimi Code Subscription  ·  API Global  ·  API China

Thanks to Kimi for sponsoring this project! Kimi K3 is Moonshot AI's most capable model and the world's first open 3T-class model. With 2.8 trillion parameters, native vision, and a 1-million-token context window, K3 delivers frontier performance across long-horizon coding, knowledge work, and reasoning. Inside CCR, Kimi ships as a built-in provider preset: import the pay-as-you-go API or Kimi Code subscription in one click and route your coding agent's requests to Kimi. The subscription endpoint passes through natively without protocol conversion, API endpoints are adapted automatically, and account balance and subscription usage are visible in the CCR dashboard.

CCR already includes Kimi provider presets. Visit the Kimi Open Platform (中文站 | Global) to try the API, or explore the Kimi Code subscription.

Claude Code Router

Manage every agent and provider from one place.

Connect Claude Code, Claude Design, Codex, Grok CLI, Kimi CLI, Kilo Code, OpenCode, Pi, ZCode, WorkBuddy, and compatible API clients to the providers you choose—then route, fail over, extend, and observe every request from one app.

Download Desktop Quick Start Read the Docs

Chinese README Discord X License


Claude Code Router Desktop dashboard

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:

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
Claude Code logo
Claude Code (CLI & APP)
Codex logo
Codex (CLI & APP)
Grok CLI logo
Grok CLI (CLI)
Kimi CLI logo
Kimi CLI (CLI)
Kilo Code logo
Kilo Code (CLI)
OpenCode logo
OpenCode (CLI & APP)
Pi logo
Pi (CLI)
ZCode logo
ZCode (APP)
Claude Design logo
Claude Design (APP)
WorkBuddy logo
WorkBuddy (APP)

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:

npm install -g @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

npm run docker:compose:up

Docker exposes the management UI and gateway routes through http://127.0.0.1:3458 by default. The npm script prepares the local plugin-capable ai-gateway runtime before building the image when ../../next-ai/gateway exists. 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

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

If you find this project helpful, please consider sponsoring its development. Your support is greatly appreciated.

Support on Ko-fi
One-time support via Ko-fi
Sponsor with PayPal
International sponsorship
Alipay
Alipay QR code
WeChat Pay
WeChat Pay QR code

Our Sponsors

A huge thank you to all our sponsors for their generous support.

Zhipu icon
Z智谱
AIHubmix icon
AIHubmix
BurnCloud icon
BurnCloud
302.AI icon
302.AI
RunAPI icon
RunAPI
TeamoRouter icon
TeamoRouter
code0.ai icon
code0.ai
claudeapi icon
claudeapi
Qiniu Cloud AI icon
Qiniu Cloud AI
Fenno.ai icon
Fenno.ai
Unity2.Ai icon
Unity2.Ai
无限星河 icon
无限星河

Community Sponsors

@Simon Leischnig @duanshuaimin @vrgitadmin @*o @ceilwoo @*说
@*更 @K*g @R*R @bobleer @*苗 @*划
@Clarence-pan @carter003 @S*r @*晖 @*敏 @Z*z
@*然 @cluic @*苗 @PromptExpert @*应 @yusnake

claude-code-router (musistudio/claude-code-router)

Searching Database…

这是什么?Claude Code Router(CCR)是一个本地模型网关和编程智能体的控制中心:你的智能体只需连接一个稳定的本地端点,而你可以在一个应用里统一管理服务商、模型、路由规则和工具。
它是桌面应用还是命令行工具?两者都有。推荐的方式是 macOS、Windows 和 Linux 的桌面应用;也有一个 npm CLI,它运行同样的网关,但用浏览器管理界面代替 Electron;此外还提供 Docker 镜像。
我该怎么把它跑起来?启动应用,添加一个服务商(选一个预设、粘贴 API 密钥、选择模型),在 Server 页面点击 Start,然后在 Agent Config 里选择你的智能体和模型并应用配置。
我可以把哪些编程智能体接上去?CLI 和应用形式的 Claude Code 与 Codex,Grok CLI、Kimi CLI、Kilo Code 和 Pi 这些命令行工具,两种形态都支持的 OpenCode,以及 ZCode、Claude Design 和 WorkBuddy 这些应用——另外任何兼容的 API 客户端也都可以。
安装上有什么要注意的坑吗?CLI 需要 Node.js 22 或更新版本;因为 better-sqlite3 自带原生的 Electron 模块,Windows 安装包必须在 Windows x64 上构建;用 Docker 部署的话,应该先看部署指南。
我的流量会留在自己电脑上吗?会——CCR 是运行在你电脑上的本地网关,把请求转发到你配置的服务商;文档只提醒在对外远程暴露之前,先读一下 Docker 部署指南。
为什么要用一个统一的控制中心,而不是每个智能体单独配置?没有 CCR 时,你得为每个客户端单独维护一套模型配置。有了 CCR,智能体和服务商可以统一管理:切换模型或服务商只需在一个应用里应用一份配置,不用反复修改每个智能体的配置文件。
我能控制谁有权使用我的网关吗?可以——你可以签发带有效期的独立 CCR 客户端密钥,并对请求、令牌和图片设置本地限额,这样共享访问始终在你的掌控之内。
AgentClaw 是什么?一个内置的中继服务,把你的智能体接入聊天平台:Weixin iLink、WeCom、Slack、Discord、Telegram、LINE、飞书和钉钉——这样你就能从已经在用的聊天软件里操控智能体。
Creator
musistudio
Size
45.7 MB
Stars
37.7K
Age
1y
Commits · 90 Days