claude-code-router  by musistudio

Router for Claude Code requests

created 5 months ago
9,052 stars

Top 5.7% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a framework for routing requests to different coding models, aiming to reduce costs and improve efficiency by leveraging specialized models for specific tasks. It's designed for developers and researchers experimenting with LLM-based coding infrastructure who want to integrate Anthropic's Claude Code capabilities with potentially more cost-effective or specialized open-source models.

How It Works

The router operates in two modes: Normal and Router. Router mode, the primary focus, dispatches tasks to distinct models: a lightweight "router" model (e.g., qwen2.5-coder-3b) for initial request classification, a "tool invoker" model (e.g., qwen-max-0125) for function calling, a "coder" model (e.g., deepseek-v3), and a "reasoning" model (e.g., deepseek-r1). This separation allows for the use of models without function-calling capabilities for coding tasks, while leveraging KV-Cache support to minimize token consumption and costs.

Quick Start & Requirements

  • Install via npm: npm install -g @anthropic-ai/claude-code
  • Clone repo: git clone https://github.com/musistudio/claude-code-reverse.git
  • Install dependencies: npm i
  • Run server: node index.mjs
  • Requires Node.js and npm.
  • API keys and base URLs for various models (Anthropic, Alibaba Cloud, DeepSeek) need to be configured via environment variables or an .env file.
  • Supports proxy configurations.

Highlighted Details

  • Leverages qwen2.5-coder-3b for routing and DeepSeek models for coding/reasoning to reduce costs.
  • Supports both a single-model "Normal Mode" and a multi-model "Router Mode."
  • Router mode separates tool invocation from coding, enabling models without function-calling support for code generation.
  • Configurable via environment variables for different model endpoints and API keys.

Maintenance & Community

  • The repository is maintained by musistudio.
  • No specific community channels (Discord/Slack) or roadmap links are provided in the README.

Licensing & Compatibility

  • The README does not explicitly state a license. The project uses @anthropic-ai/claude-code, which implies potential dependencies on Anthropic's terms of service.

Limitations & Caveats

This project is explicitly stated to be for testing purposes and may consume significant tokens, fail to complete tasks, or incur high costs. The "Normal Mode" requires a single model that supports function calling and a large tool description length.

Health Check
Last commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
30
Issues (30d)
274
Star History
9,370 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.