v0.1.0 — Claude Code Router in Go
First release.
A clean-room Go reimplementation of @musistudio/claude-code-router (MIT). No upstream source was copied; the wire formats, CLI grammar, configuration layout and default ports are reproduced deliberately so existing installations keep working. Upstream attribution is retained in NOTICE.
Why
A 26MB static binary with zero Node dependencies, replacing a Node 22+ runtime requirement.
What works
| Area | Detail |
|---|---|
| Gateway | Gin; HTTP/3+QUIC (opt-in, TLS-required); brotli → gzip → identity |
| Endpoints | POST /v1/messages (non-streaming + SSE), GET /health, GET /ready |
| Translate | Anthropic ↔ OpenAI: system prompts, content blocks, tool_use/tool_result, cleancache |
| Router | default/background routing, explicit provider/model selector, failure classification, fallback chain |
| Proxy | verbatim endpoint; HTTP(S)_PROXY/NO_PROXY and authenticated upstream proxies |
| CLI | start, ui, serve, web, stop, profile grammar, --gateway-host/--gateway-port |
Compatibility
- Loads an existing
~/.claude-code-router/config.jsonunchanged — verified against a real 20-provider config. ccr --helpcontainsccr start/ccr serve, so claude_toolkit's identity guard accepts this binary.ccr <unknown>printsProfile "<unknown>" was not found or is disabled.and exits 1, matching Node.
Verification
- 12 packages green under
go test -race scripts/preflight.sh— 5/5 (gofmt, vet, build, race, secret scan)- Mutation harness: killed=6, survived=0
- HelixQA: 96 schema-validated cases; chaos: 12 scenarios; security: 14 tests
- Live-socket verified:
/health,/ready, brotli 91B→33B decoded over the wire
Known limitations
- Inbound auth (
RequireAPIKey) exists but is not installed on any route — enabling it by default would break existing callers. - The fallback/retry classifiers are not yet driven by a retry loop;
proxy.Client.Domakes one attempt. - Vision/image content blocks return an explicit error rather than being silently dropped.
- One upstream GAP deliberately unported: ambiguous bare-model resolution would let a request bypass
Router.default.
🤖 Generated with Claude Code