Skip to main content

Basic Configuration

Learn how to configure Claude Code Router to suit your needs.

Configuration File Location

The configuration file is located at:

~/.claude-code-router/config.json

Configuration Structure

Providers

Configure LLM providers to route requests to:

{
"Providers": [
{
"NAME": "deepseek",
"HOST": "https://api.deepseek.com",
"APIKEY": "your-api-key",
"MODELS": ["deepseek-chat", "deepseek-coder"]
},
{
"NAME": "groq",
"HOST": "https://api.groq.com/openai/v1",
"APIKEY": "your-groq-api-key",
"MODELS": ["llama-3.3-70b-versatile"]
}
]
}

Router

Configure which model to use by default:

{
"Router": {
"default": "deepseek,deepseek-chat"
}
}

Format: {provider-name},{model-name}

Transformers

Apply transformations to requests/responses:

{
"transformers": [
{
"name": "anthropic",
"providers": ["deepseek", "groq"]
}
]
}

Environment Variables

Use environment variables in your configuration:

{
"Providers": [
{
"NAME": "deepseek",
"HOST": "https://api.deepseek.com",
"APIKEY": "$DEEPSEEK_API_KEY"
}
]
}

Both $VAR_NAME and ${VAR_NAME} syntax are supported.

Proxy

  • PROXY_URL (optional): HTTP(S) proxy used for outbound provider requests, for example "PROXY_URL": "http://127.0.0.1:7890".
  • Requests to loopback addresses (localhost, 127.0.0.1, ::1) always bypass the proxy.
  • Hosts listed in the process environment variables NO_PROXY / no_proxy also bypass the proxy. The list is comma-separated and supports bare hosts, .domain / *.domain suffixes, CIDR ranges, and optional :port entries.

Example:

export NO_PROXY="api.anthropic.com,.internal,10.0.0.0/8,localhost"

Complete Example

{
"port": 8080,
"Providers": [
{
"NAME": "deepseek",
"HOST": "https://api.deepseek.com",
"APIKEY": "$DEEPSEEK_API_KEY",
"MODELS": ["deepseek-chat", "deepseek-coder"],
"transformers": ["anthropic"]
},
{
"NAME": "groq",
"HOST": "https://api.groq.com/openai/v1",
"APIKEY": "$GROQ_API_KEY",
"MODELS": ["llama-3.3-70b-versatile"],
"transformers": ["anthropic"]
}
],
"Router": {
"default": "deepseek,deepseek-chat",
"longContextThreshold": 100000,
"background": "groq,llama-3.3-70b-versatile"
},
"transformers": [
{
"name": "anthropic",
"providers": ["deepseek", "groq"]
}
]
}

Editing Configuration

Use the CLI to edit the configuration:

ccr config edit

This will open the configuration file in your default editor.

Reloading Configuration

After editing the configuration, restart the router:

ccr restart

Next Steps