1.5 KiB
1.5 KiB
Claude Code Router
This is a repository for testing routing Claude Code requests to different models.
Implemented
-
Support writing custom plugins for rewriting prompts.
-
Support writing custom plugins for implementing routers.
Usage
- Install Claude Code
npm install -g @anthropic-ai/claude-code
- Clone this repo and install dependencies
git clone https://github.com/musistudio/claude-code-router
cd claude-code-router && pnpm i
npm run build
- Start claude-code-router server
node dist/cli.js
- Set environment variable to start claude code
export DISABLE_PROMPT_CACHING=1
export ANTHROPIC_BASE_URL="http://127.0.0.1:3456"
export API_TIMEOUT_MS=600000
claude
Plugin
The plugin allows users to rewrite Claude Code prompt and custom router. The plugin path is in $HOME/.claude-code-router/plugins. Currently, there are two demos available:
You need to move them to the $HOME/.claude-code-router/plugins directory and configure 'usePlugin' in $HOME/.claude-code-router/config.json,like this:
{
"usePlugin": "gemini",
"LOG": true,
"OPENAI_API_KEY": "",
"OPENAI_BASE_URL": "",
"OPENAI_MODEL": ""
}
