Claude Code Router Go
A lightweight Go implementation of Claude Code Router
Smart Routing for AI Models
CCG is a Go-based implementation of CCR. Due to WSL frequently crashing from high memory usage, this project was created to provide a lightweight alternative.
Key Benefits
- Low Memory: ~30MB vs ~150MB (Node.js version)
- Fast Startup: ~0.1s vs ~2s (Node.js version)
- No Dependencies: Single binary, no runtime required
This project is a product of Vibe Coding.
I don't know how to write Go code. Not a single line was written by hand - the entire codebase was generated through conversations with AI. I just described what I needed for my WSL environment and let AI handle the implementation. (Yes, this sentence was also written by AI.)
# One-line install
curl -fsSL https://raw.githubusercontent.com/visvioce/ccg/master/install.sh | bash
# Build from source
git clone https://github.com/visvioce/ccg.git
cd ccg
make install-
Configure environment variables:
export OPENAI_API_KEY="your-key" export DEEPSEEK_API_KEY="your-key" # Add other provider keys as needed
-
Start the server:
ccg start
-
Open Web UI:
ccg ui
| Command | Description |
|---|---|
ccg start |
Start server |
ccg stop |
Stop server |
ccg restart |
Restart server |
ccg status |
Show server status |
ccg ui |
Open Web UI in browser |
| Command | Description |
|---|---|
ccg model |
List available models |
ccg env |
Show environment variables |
ccg activate |
Output env vars for shell |
ccg version |
Show version |
| Command | Description |
|---|---|
ccg code <prompt> |
Execute AI command |
| Command | Description |
|---|---|
ccg preset list |
List presets |
ccg preset info <name> |
Show preset info |
ccg preset install <source> |
Install preset |
ccg preset export <name> |
Export preset |
ccg preset delete <name> |
Delete preset |
| Command | Description |
|---|---|
ccg install <name> |
Install preset from marketplace |
File: ~/.ccg/config.json
{
"HOST": "127.0.0.1",
"PORT": "3456",
"providers": [
{
"name": "openai",
"api_base_url": "https://api.openai.com/v1/chat/completions",
"api_key": "${OPENAI_API_KEY}",
"models": ["gpt-4o", "gpt-4o-mini"],
"transformer": { "use": [] }
}
],
"Router": {
"default": "openai,gpt-4o",
"background": "openai,gpt-4o-mini",
"think": "openai,gpt-4o",
"longContext": "openai,gpt-4o",
"longContextThreshold": 60000,
"webSearch": "openai,gpt-4o"
}
}CCG works with any OpenAI-compatible API. Configure providers in the providers array.
Routes requests based on scenario:
| Scenario | Description |
|---|---|
default |
General requests |
background |
Low-priority tasks |
think |
Complex reasoning |
longContext |
Long context (>threshold tokens) |
webSearch |
Web search |
POST http://localhost:3456/v1/chat/completions
GET http://localhost:3456/v1/models