Claude Code Router logo

Claude Code Router

Free

Claude Code Router - Route Claude Code to Any LLM Provider

Developer ToolsFreeFree tier
#claude-code#llm-proxy#open-source#model-routing#deepseek#ollama#openrouter#gemini#api-proxy#developer-tools
Inputs: text, codeOutputs: text, code
Type
Saas
Company
Claude Code Router
Claude Code Router screenshot

About Claude Code Router

Claude Code Router is an open-source Node.js command-line interface (CLI) tool that extends Anthropic's Claude Code CLI. It serves as a foundation for coding infrastructure, enabling users to route AI coding requests to various large language models (LLMs) from different providers such as OpenRouter, DeepSeek, Ollama, Google Gemini, and Volcengine. This tool offers enhanced flexibility and customization for AI coding workflows, allowing users to tailor coding assistance to specific needs, optimize for different tasks (e.g., background processing, high-reasoning, long contexts), and manage costs by selecting appropriate models. It builds upon Anthropic's official tools, offering additional customization options and dynamic model switching.

How to Use

To use Claude Code Router, first ensure Node.js and npm are installed. Then, install Anthropic’s Claude Code CLI by running npm install -g @anthropic-ai/claude-code. Next, install the router itself with npm install -g @musistudio/claude-code-router, which adds the ccr command. Launch the router by running ccr code. Users can optionally configure routing rules and providers by creating or editing the ~/.claude-code-router/config.json file. This configuration allows defining API keys, base URLs, available models, and specific roles for models (e.g., default, background, think, longContext). Once set up, users interact with Claude Code as normal, and the router intercepts and forwards requests based on the configuration. Models can also be switched dynamically at runtime using the /model provider,model command.

Claude Code Router's

Key Features

  • Multi-model Routing: Route queries to any configured provider or model, with dynamic switching using commands like /model provider,model.
  • Specialized Model Roles: Designate specific models for background tasks, high-reasoning tasks (think mode), and handling long contexts.
  • Extensibility: Supports integration with image and web-search tools, detailed logging, and GitHub Actions.
  • Flexible Configuration: Fully customizable via a JSON config file (~/.claude-code-router/config.json) for providers and routing rules.
  • Cost Optimization: Route requests to more cost-effective models for specific tasks to reduce overall AI coding assistance costs.

Use Cases

  • Tailoring AI coding assistance to specific project needs.
  • Optimizing AI model usage for different tasks (e.g., using a simpler model for background tasks, a powerful model for reasoning).
  • Managing large conversations or codebases with models optimized for long contexts.
  • Automating code reviews or creating issue bots via GitHub Actions integration.
  • Reducing AI coding costs by routing requests to more economical models.

Key Features

Model routing to different LLM providers based on task type
Multi-provider support: OpenRouter, DeepSeek, Ollama, Gemini, Volcengine, SiliconFlow
Request/response transformation between provider formats
Dynamic model switching with /model command mid-session
CLI model management with ccr model commands
GitHub Actions integration for CI/CD workflows
Plugin system for custom transformers
Environment variable interpolation for secure API key management
API key authentication for shared deployments
Dual logging system with pino HTTP logs and application-level logs

Pros & Cons

Pros
  • Open-source and appears to be free to use, with no licensing costs
  • Reduces vendor lock-in by allowing multiple LLM providers from a single setup
  • Enables cost savings by routing expensive tasks to cheaper providers as needed
  • Supports a wide range of providers including local, private, and cloud models
  • Provides flexible request/response transformation for adapting to different provider APIs
Cons
  • Requires the Claude Code CLI to be preinstalled and configured (not a standalone tool)
  • May introduce additional latency due to the routing layer between Claude Code and the provider
  • Setup and configuration may require familiarity with proxying and LLM API endpoints
  • Support quality and feature parity may vary across different providers
  • As an open-source community project, documentation and updates may be less comprehensive than commercial alternatives

Best For

undefined: undefinedundefined: undefinedundefined: undefined

Alternatives to Claude Code Router