A local proxy that sits between your LLM clients and your providers. Point Claude Code, Cursor, or anything Anthropic/OpenAI-compatible at it, and it handles the rest.
CCR lets you route your LLM traffic through a single local server. Point any Anthropic-compatible client at it, and CCR handles the rest: load balancing between providers, failing over to backup models when one is unavailable, tracking usage and costs per API key, and managing credentials from a web dashboard.
It is particularly useful if you are:
- Working across multiple LLM providers
- Self-hosting internal models via OpenAI-compatible endpoints alongside commercial APIs
- Using Claude Code and want a single place to manage model access
- Unified Anthropic API — present one endpoint to your clients; route to Anthropic, OpenAI, or any OpenAI-compatible backend
- Smart Fallbacks — define model chains so requests automatically retry backup models or providers when the primary is down or rate-limited
- API Key Management — mint and revoke per-client keys with built-in usage tracking
- Live Admin Dashboard — built-in web UI with real-time request logs, token consumption charts, and key management
- Hot Config Reload — edit
config.tomlwhile the server is running; no restarts needed - Pure Go, No CGO — ships as a single static binary on any Go-supported platform
- SQLite-backed — zero external database dependencies; everything stores locally
Download and run the install script for your platform — it fetches the latest pre-built binary from GitHub Releases.
Windows — run setup.bat from the repo, or use the one-liner in PowerShell:
irm https://raw.githubusercontent.com/blobbyblo/ClaudeCodeRouter/main/setup.ps1 | iexLinux / macOS — run in your terminal:
curl -fsSL https://raw.githubusercontent.com/blobbyblo/ClaudeCodeRouter/main/install.sh | bashThe script installs the binary, writes a sample config.toml, and optionally registers a background service.
Use your client key (created via the admin dash) as the API key. Point your app at http://127.0.0.1:4080/v1/messages for Anthropic format, or http://127.0.0.1:4080/v1/chat/completions for OpenAI format.
git clone https://github.com/blobbyblo/ClaudeCodeRouter.git
cd ClaudeCodeRouter
make build # outputs bin/ccr
make run # or go run ./cmd/ccrThe server starts on port 4080 (client) and 4081 (admin dashboard). Edit config.toml to add your API keys and model aliases.
CCR uses a single config.toml file. The server creates a default one the first time it starts. Here is a typical setup:
[server]
client_port = 4080
admin_port = 4081
log_level = "info"
[providers.anthropic]
base_url = "https://api.anthropic.com"
convention = "anthropic"
[providers.deepnim]
base_url = "http://localhost:8123"
convention = "openai"
[[models]]
alias = "opus"
fallback_to = "sonnet"
[[models.providers]]
provider = "anthropic"
model_id = "claude-opus-4-7"
[[models]]
alias = "sonnet"
[[models.providers]]
provider = "deepnim"
model_id = "deepseek-v3"Key ideas:
- Providers define how to talk to a backend (
anthropicoropenaiconvention). - Models are aliases you send from your client (e.g.,
opus). Each alias maps to one or more real model IDs on one or more providers, plus an optionalfallback_tochain. - Provider keys are stored in the database (not the config file) and managed through the admin UI.
Open http://127.0.0.1:4081 in your browser.
Navigate to Keys in the dashboard. Click New Key, give it a name, and a token like sk-ccr-xxx is generated. Hand this token to your client app; every request made with it is tracked and can be revoked later.
Visit Providers in the dashboard. Add the provider's name, base_url, and convention (anthropic or openai). Then switch to the Keys tab for that provider and add one or more API keys. CCR rotates through keys per provider in round-robin fashion.
Visit Models in the dashboard. Add an alias, pick which provider to route through, and map it to the actual remote model ID. If you want a fallback chain, set Fallback To to another model alias. Edit config directly via Raw Config if you prefer.
The Dashboard page shows live request streams, hourly token usage graphs, and per-key summaries. Everything is stored in the local SQLite database (default ccr.db).
CCR exposes a standard Anthropic-compatible API on the client port. All endpoints require authentication via x-api-key header or Authorization: Bearer <key>.
| Endpoint | Method | Description |
|---|---|---|
/v1/messages |
POST |
Anthropic Messages API |
/v1/chat/completions |
POST |
OpenAI Chat Completions API (returns OpenAI format) |
/v1/models |
GET |
List configured model aliases |
The admin API is available under /admin/api/ for programmatic access.
+--------+ +------------------------+ +-------------------+
| Client | --> | CCR Client Server | --> | Anthropic API |
+--------+ | (port 4080) | +-------------------+
| |
| - Key auth | +-------------------+
| - Model resolution | --> | OpenAI / NIM / ...|
| - Fallback chain | +-------------------+
| - Rate-limit retry |
+------------------------+
|
v
+------------------------+
| CCR Admin Server | +---------+
| (port 4081) | --> | SQLite |
| | | Database |
| - Web dashboard | +---------+
| - Key management |
| - Usage analytics |
| - Real-time logs |
+------------------------+
# Run tests
make test
# Build release binary
make release # creates bin/ccr-linux-amd64
# Clean build artifacts
make cleancmd/ccr/— main entry pointrouter/— HTTP proxy, request routing, and fallback logicproviders/— provider implementations (Anthropic, OpenAI conventions)admin/— admin HTTP server and embedded web dashboarddb/— SQLite schema and queriesconfig/— TOML config loader with hot-reload watchermiddleware/— auth and SSE log broadcaster
Distributed under the MIT License.