Coding CLI · configuration guide + live pricing · sign up for trial credit
Claude Code Router (CCR) is an open-source routing layer: Claude Code requests first hit a local router, which forwards them by scenario (default / long context / thinking / background) to different models — cheap models can replace the default route to cut cost.
Claude Code Router in one line: Local routing layer: split scenarios across models to cut cost. Recommended models and their market floor prices are in the table below; the full catalog is at https://321ai.cc/en/models/.
| Setting | Value | Notes |
|---|---|---|
Provider name | 321ai (custom) | Providers section of config.json |
api_base_url | https://321ai.cc/v1 | OpenAI-compatible provider, include /v1 |
api_key | API key from the console | |
models | array of model names on sale | e.g. claude-fable-5-2, deepseek-v4 |
Router.default | 321ai,<model name> | route the default scenario to that provider |
1. Install: npm install -g @musistudio/claude-code-router (check the official README)
2. Edit ~/.claude-code-router/config.json: add the relay under Providers and point Router.default at it
3. Start with ccr code instead of claude — requests flow through the local router into the relay
| What | Where | Notes |
|---|---|---|
| Live market floor pricing | https://321ai.cc/en/models/ | input per 1M tokens, per-supplier quotes on the marketplace |
Prices are the multi-supplier market floor and move in realtime; see all model prices →
Environment variables send every request to one model; CCR splits by scenario (long-context work on a big-window model, background jobs on a cheap one) for further savings.
Default ~/.claude-code-router/config.json; field names follow the official README.