The Problem

Claude Code is a capable coding agent, but it is locked to Anthropic's models. Teams that want to route requests to cheaper or specialized models (DeepSeek, Ollama, GLM, etc.) have to abandon the tool or build a custom proxy. This project removes that constraint by turning Claude Code into a router that can forward requests to any provider while keeping the familiar CLI workflow.

What This Does

claude-code-router (CCR) is a two-part system: a CLI (packages/cli/src/cli.ts) and a core server (packages/core/src/api/routes.ts). The CLI installs a wrapper that intercepts Claude Code's API calls and redirects them to a local server. The server then routes each request to a configured provider based on rules you define, transforms the request/response payloads as needed, and returns the result.

The routing logic lives in packages/core/src/plugins/ — there's a plugin-manager.ts for extension, token-speed.ts for token accounting, and an output system (output-manager.ts) that can send results to console, temp files, or webhooks. The CLI adds operational commands like /model for runtime switching and ccr model for terminal-based management, all documented in docs/docs/cli/.

How To Use It

Setup

npm install -g @anthropic-ai/claude-code npm install -g @musistudio/claude-code-router

Configuration

Create ~/.claude-code-router/config.json. Key sections per the README: PROXYURL (optional proxy), APIKEY (auth secret, forces host to 127.0.0.1 if unset), HOST, LOG/LOGLEVEL, and NONINTERACTIVEMODE for CI environments. Provider credentials go under provider-specific keys in the same file — see docs/docs/server/config/providers.md for the full schema.

Running it

Start the server with ccr start, then run claude as normal. The router intercepts requests automatically. Use /model inside Claude Code to switch providers on the fly, or ccr model from the terminal. GitHub Actions integration is supported via the NONINTERACTIVEMODE flag.

Real-World Use

A team standardized on Claude Code but wants to cut API costs. They configure two routes: background refactoring tasks go to DeepSeek via OpenRouter, while complex architecture discussions stay on Anthropic's flagship model. A transformer in packages/core/src/plugins/ normalizes DeepSeek's response format so Claude Code never notices the difference. The /model command lets a developer force a specific provider mid-session when they hit a tricky bug.

Code Health & Issues

Med – No lockfile in docs/package.json; Docusaurus builds are not reproducible. Med – Only 3 test files across the entire repo, and none visible in the core routing/plugin logic (packages/core/src/). The routing table is the highest-risk code and is untested. Low – A full backup directory (docs/i18n/zh-CN/docusaurus-plugin-content-docs.backup.20260101_205603/) is committed to the repo. Dead weight and confusing. Low – No LICENSE file in the repo despite a badge in the README pointing to one. Verify before adopting. Low – The custom-router.example.js in the root suggests a plugin API, but the docs for it (docs/docs/server/advanced/custom-router.md) are not in the English current docs set.

The Bottom Line

This is a pragmatic tool for teams already invested in Claude Code who want provider flexibility without abandoning the CLI. The architecture is clean (CLI/server separation, plugin-based output handlers), but the lack of tests on the core routing logic is a real risk for a tool that sits between your editor and your models. Worth adopting for internal use; treat it as infrastructure you'll need to monitor, not as a set-and-forget dependency.