

Claude Code Router redefines AI-powered development by intelligently orchestrating coding requests across a diverse ecosystem of large language models. Built as an open-source, production-ready Node.js CLI extension to Anthropic’s Claude Code, it transforms static model usage into a dynamic, context-aware routing engine. Rather than locking developers into a single LLM—regardless of task complexity, latency tolerance, or budget constraints—the router evaluates each coding request in real time and dispatches it to the optimal model based on purpose, performance profile, and cost efficiency. Supported providers include OpenRouter, DeepSeek, Ollama (for local inference), Google Gemini, and Volcengine—enabling seamless hybrid workflows that blend cloud scalability with on-device privacy and affordability.
Installation is streamlined and developer-first. With Node.js and npm already installed, run npm install -g @anthropic-ai/claude-code to set up the base CLI, then add intelligent routing with npm install -g @musistudio/claude-code-router. This registers the ccr command globally. Launch your enhanced coding assistant with ccr code. For granular control, create or edit ~/.claude-code-router/config.json to define provider credentials, model availability, and role-based routing policies—including defaults for everyday tasks, dedicated “think” models for complex reasoning, lightweight “background” models for low-priority automation, and long-context specialists for repository-scale analysis. Once configured, all interactions remain intuitive: type as usual in Claude Code—and behind the scenes, the router makes intelligent, real-time decisions about where—and how—to execute each request.
/model openrouter,google/gemini-2.5-pro-preview, with support for fallback chains and load-aware balancing.For technical assistance, feature requests, or billing inquiries, visit our dedicated support portal.
Claude Code Router is developed and maintained by Musistudio—a team passionate about democratizing intelligent, sustainable AI tooling for developers.
Learn more about our mission and open-source philosophy on the About Us page.
Claude Code Router operates entirely client-side—no login or account required. All configuration and execution happen locally on your machine.
Explore the source, submit pull requests, or join discussions on GitHub: https://github.com/musistudio/claude-code-router
Claude Code Router is an open-source, MIT-licensed CLI extension that adds intelligent, policy-driven model routing to Anthropic’s Claude Code. It enables developers to treat LLMs as interchangeable, purpose-built components—selecting the right model, at the right time, for the right task—while continuously optimizing for speed, accuracy, and cost.
The router integrates live pricing data from supported providers (e.g., per-token rates from OpenRouter, tiered costs from Volcengine) and correlates them with historical performance metrics. When a request matches predefined criteria—such as low-complexity code generation or non-critical documentation—it automatically selects the most cost-efficient model that meets minimum quality benchmarks—without user intervention.
Yes. Through advanced configuration, you can define daily or session-level spending limits, set automatic model downgrade thresholds, and enable console notifications—or even halt routing—when projected costs exceed configured budgets.
No. The routing decision engine executes in under 5ms on modern hardware. For most workflows, latency is dominated by the selected LLM’s inference time—not the router itself. Optional caching and connection pooling further minimize overhead.
Roles are enforced through both automatic heuristics (e.g., detecting “explain this algorithm” triggers think-mode routing) and explicit user commands (/think, /bg, /long). You retain full control—override defaults anytime, or lock roles per project via config profiles.
Absolutely. Any model accessible via standard LLM APIs—including self-hosted Llama 3 variants on Ollama, custom fine-tunes on Volcengine, or enterprise-deployed Gemini instances—can be registered and routed with full parameter control.
All API keys are stored locally in encrypted, user-owned config files (~/.claude-code-router/config.json) with strict filesystem permissions. No credentials ever leave your device or touch external servers.
Yes—opt-in, local-only telemetry provides detailed breakdowns: tokens consumed per model, cost per session, average latency by role, and routing success/failure rates. Data never leaves your machine unless explicitly exported.
Claude Code Router is released under the permissive MIT License—free for commercial use, modification, and redistribution, with no royalties or restrictions.
We welcome contributions! Visit GitHub to report bugs, propose enhancements, or submit documentation improvements. Our contribution guide and issue templates ensure smooth onboarding.
Fully. Function calling, structured output, image input (via Gemini and OpenRouter-compatible endpoints), and tool-use orchestration are all preserved and normalized across providers—so your prompts and plugins work consistently, regardless of backend.