✏️ Edit mode

🔐 Authorized Access

Editing pages requires a GitHub account.
The wiki password unlocks edit buttons.

✏️ Edit

⚡ CC Router Wiki

Welcome to the CC Router Wiki — the complete knowledge base for running Claude Code with multiple LLM backends: DeepSeek V4 Pro DeepSeek Flash MiniMax M3 GLM‑5.1

Claude Code ──▶ cc‑proxy :3456 ──▶ api.minimax.io
├──▶ api.deepseek.com
└──▶ api.z.ai

🔄 Dynamic Switching

Change models with /model inside Claude Code or cc-model from terminal.

⚡ One‑Click Deploy

python3 setup.py does everything: proxy, config, auto‑start, verification.

🌐 International Endpoints

Pre‑configured with api.minimax.io, api.z.ai — no 401 traps.

📦 4 LLMs

DeepSeek Pro, Flash, MiniMax M3, GLM‑5.1 from one Claude Code instance.

New here? Start with Quick Start.
✏️ Edit

🚀 Quick Start

Home / Quick Start

1. Get API Keys

ProviderGet Key AtKey Format
DeepSeekplatform.deepseek.com → API Keyssk-xxxxxxxx
MiniMaxplatform.minimaxi.com → API Keyssk-cp-xxxxxxxx
GLM‑5 (opt)open.bigmodel.cn → API Keysxxx.yyy

2. Clone & Configure

git clone https://github.com/ai-caseylai/cc-router.git
cd cc-router
# Edit setup.py — fill in your API keys

3. One‑Click Deploy

python3 setup.py

4. Launch

source ~/.zshrc && claude
✏️ Edit

📦 Installation

Home / Installation

Prerequisites

Automatic (macOS)

python3 setup.py

Manual

# 1. Start proxy
python3 ~/Documents/minimax/cc-proxy.py &

# 2. Configure settings.json
# → See "settings.json" page for full config

# 3. Add alias
echo "alias cc-model='bash ~/Documents/minimax/cc-model.sh'" >> ~/.zshrc

Verify

curl http://127.0.0.1:3456/health     # → {"status":"ok"}
claude                                 # /status → http://127.0.0.1:3456
✏️ Edit

DeepSeek

Home / Providers / DeepSeek
ModelIDUse Case
DeepSeek V4 Prodeepseek-v4-pro[1m]Heavy coding, reasoning, 1M context
DeepSeek Flashdeepseek-v4-flashQuick answers, background tasks

Endpoint

https://api.deepseek.com/anthropic/v1/messages

API Key

Register at platform.deepseek.com, top up, create key → sk-xxxxxxxx. One key serves both models.

Aliases

AliasMaps To
deepseek-chatdeepseek-v4-flash
deepseek-reasonerdeepseek-v4-pro[1m]
✏️ Edit

MiniMax M3 ⚠️ tricky

Home / Providers / MiniMax M3
Biggest trap: Their docs show api.minimaxi.com which returns 401 invalid api key for non‑CN users. Always use api.minimax.io.
ModelIDKey PrefixAuth Header
MiniMax M3MiniMax-M3sk-cp-x-api-key

Correct Endpoint

https://api.minimax.io/anthropic/v1/messages   ← ✅ International
https://api.minimaxi.com/anthropic/v1/messages  ← ❌ CN only → 401

Test Connectivity

curl -s https://api.minimax.io/anthropic/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: sk-cp-YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"model":"MiniMax-M3","max_tokens":5,"messages":[{"role":"user","content":"hi"}]}'

Features

✏️ Edit

GLM‑5.1 (Zhipu AI)

Home / Providers / GLM‑5.1
ModelIDKey Format
GLM‑5.1glm-5.1xxx.yyy.zzz

Endpoints

RegionEndpoint
Internationalhttps://api.z.ai/api/anthropic/v1/messages
Chinahttps://open.bigmodel.cn/api/anthropic/v1/messages

API Key

Register at open.bigmodel.cn, create key.

✏️ Edit

🌐 International Endpoints

Home / Providers / Endpoints
Provider✅ International❌ Do NOT Use
DeepSeekapi.deepseek.com
MiniMaxapi.minimax.ioapi.minimaxi.com → 401
GLM‑5.1api.z.aiopen.bigmodel.cn (CN only)

How Claude Code Connects

"ANTHROPIC_BASE_URL": "http://127.0.0.1:3456"   ← local proxy
"ANTHROPIC_AUTH_TOKEN": "dummy"                ← proxy handles real auth

The proxy strips ?beta=true query params and routes by model field.

✏️ Edit

🕹️ Model Switching

Home / Usage

Terminal

cc-model pro        # Default=DeepSeek Pro  → Haiku=MiniMax
cc-model flash      # Default=DeepSeek Flash → Haiku=MiniMax
cc-model minimax    # Default=MiniMax       → Haiku=DeepSeek Pro
cc-model glm        # Default=GLM‑5.1       → Haiku=MiniMax
cc-model status     # Show mapping + proxy health

Inside Claude Code

Type /model → arrow keys → Default ↔ Haiku. No restart needed.

Why only 2 slots? Claude Code's /model picker only shows Default + Haiku + current custom model in non‑Anthropic mode. Use cc-model to rotate which models fill those slots.
✏️ Edit

cc-model CLI

Home / Usage / cc-model

The cc-model command updates ~/.claude/settings.json to remap which models appear in /model's two slots.

Installation

# Auto (setup.py)
python3 setup.py

# Manual
echo "alias cc-model='bash ~/Documents/minimax/cc-model.sh'" >> ~/.zshrc

Commands

CommandDefault SlotHaiku Slot
cc-model prodeepseek-v4-pro[1m]MiniMax-M3
cc-model flashdeepseek-v4-flashMiniMax-M3
cc-model minimaxMiniMax-M3deepseek-v4-pro[1m]
cc-model glmglm-5.1MiniMax-M3
cc-model statusShow mapping + proxy health
✏️ Edit

🔧 Architecture

Home / Internals / Architecture

cc‑proxy is a single‑file Python HTTP server (~120 lines) using only http.server and urllib.request — zero dependencies.

Request Flow

1. Claude Code → POST /v1/messages?beta=true (model="MiniMax-M3")
2. Proxy strips ?beta=true, reads model name
3. Looks up PROVIDERS["MiniMax-M3"]
4. Forwards to https://api.minimax.io/anthropic/v1/messages
5. Streams response back (SSE supported)
6. Claude Code receives response as if from Anthropic API
✏️ Edit

📁 File Map

Home / Internals / File Map
FileRole
~/Documents/minimax/cc-proxy.pyCore router — HTTP proxy on :3456, routes by model name
~/Documents/minimax/cc-model.shSwitcher CLI — updates settings.json model mapping
~/.claude/settings.jsonClaude Code config — points to proxy, sets model slots
~/.claude.jsonOnboarding flag — must have "hasCompletedOnboarding": true
~/Library/LaunchAgents/com.cc-proxy.plistmacOS launchd — auto‑starts proxy on boot
✏️ Edit

settings.json

Home / Internals / settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:3456",
    "ANTHROPIC_AUTH_TOKEN": "dummy",
    "ANTHROPIC_MODEL": "deepseek-v4-pro[1m]",         ← Default slot
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M3",     ← Haiku slot
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "512000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  },
  "model": "deepseek-v4-pro[1m]",
  "availableModels": ["MiniMax-M3","deepseek-v4-pro[1m]","deepseek-v4-flash"]
}
Env var priority: ~/.zshrc exports > settings.json env. Always comment out ANTHROPIC_* in .zshrc.
✏️ Edit

Streaming

Home / Internals / Streaming

The proxy supports both streaming (SSE) and non‑streaming responses:

# Streaming (Claude Code default)
req["stream"] = true   → proxy reads 4KB chunks, forwards immediately

# Non‑streaming
req["stream"] = false  → proxy reads entire response, sends at once

Query Params

Claude Code sends POST /v1/messages?beta=true. The proxy strips query params before path matching (path.split("?")[0]).

Early proxy versions returned 404 because self.path == "/v1/messages" failed against "/v1/messages?beta=true". Fixed in v2.
✏️ Edit

"model may not exist"

Home / Troubleshooting

Cause: Proxy not running, or Claude Code can't reach port 3456.

# Check
curl http://127.0.0.1:3456/health

# Restart
lsof -ti :3456 | xargs kill
python3 ~/Documents/minimax/cc-proxy.py &

Also check: ANTHROPIC_BASE_URL in settings.json must be http://127.0.0.1:3456.

✏️ Edit

MiniMax 401 · invalid api key

Home / Troubleshooting / MiniMax 401

Three causes:

  1. Using api.minimaxi.com instead of api.minimax.io
  2. API key expired on MiniMax platform
  3. Key truncated or malformed (must start with sk-cp-)
curl -s https://api.minimax.io/anthropic/v1/messages \
  -H "x-api-key: sk-cp-YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"model":"MiniMax-M3","max_tokens":5,"messages":[{"role":"user","content":"hi"}]}'
✏️ Edit

API Timeout · Retrying

Home / Troubleshooting / API Timeout

Cause: ANTHROPIC_BASE_URL pointing to dead endpoint or wrong port.

Common causes:

# Check for conflicts
grep ANTHROPIC ~/.zshrc
# Comment them out
sed -i '' 's/^export ANTHROPIC_/# export ANTHROPIC_/' ~/.zshrc
✏️ Edit

Env Var Conflicts

Home / Troubleshooting / Env Var Conflicts

Priority order:

1. ~/.zshrc export ANTHROPIC_*   ← HIGHEST (overrides everything)
2. ~/.claude/settings.json env   ← MIDDLE
3. ~/.claude.json                ← LOWEST

If both .zshrc and settings.json set the same variable, the .zshrc value wins.

✏️ Edit

launchd "Operation not permitted"

Home / Troubleshooting / launchd

macOS privacy restriction.

Fix: System Settings → Privacy & Security → Full Disk Access → add /usr/bin/python3.

✏️ Edit

📋 Command Cheatsheet

Home / Reference / Cheatsheet
TaskCommand
Deploypython3 ~/Documents/minimax/cc-router/setup.py
Switch to DeepSeek Procc-model pro
Switch to DeepSeek Flashcc-model flash
Switch to MiniMaxcc-model minimax
Switch to GLM‑5.1cc-model glm
Show statuscc-model status
Proxy healthcurl http://127.0.0.1:3456/health
Model listcurl http://127.0.0.1:3456/v1/models
Restart proxylsof -ti :3456 | xargs kill && python3 ~/Documents/minimax/cc-proxy.py &
Test MiniMaxcurl -s https://api.minimax.io/anthropic/v1/messages -H "x-api-key: KEY" -H "anthropic-version: 2023-06-01" -d '{"model":"MiniMax-M3","max_tokens":5,"messages":[{"role":"user","content":"hi"}]}'
Check env conflictsgrep ANTHROPIC ~/.zshrc

Create New Page

Opens GitHub's new file form. You must be logged into GitHub.