docs/user-manual/en/4-proxy/4.2-routing.md
App routing means letting CC Switch route a specific application's API requests through the local routing service.
When routing is enabled:
The routing service must be started before using the app routing feature.
Settings > Advanced > Routing Service > App Routing area
| Toggle | Effect |
|---|---|
| Claude Routing | Route Claude Code requests |
| Codex Routing | Route Codex requests |
| Gemini Routing | Route Gemini CLI requests |
Multiple app routings can be enabled simultaneously.
When routing is enabled, CC Switch modifies the app's configuration file to point the API endpoint to the local routing service.
Claude configuration change:
// Before routing
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.anthropic.com"
}
}
// After routing
{
"env": {
"ANTHROPIC_BASE_URL": "http://127.0.0.1:15721"
}
}
Codex configuration change:
# Before routing
base_url = "https://api.openai.com/v1"
# After routing
base_url = "http://127.0.0.1:15721/v1"
Gemini configuration change:
# Before routing
GOOGLE_GEMINI_BASE_URL=https://generativelanguage.googleapis.com
# After routing
GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:15721
When the routing service receives a request:
When routing is enabled, the main interface shows the following changes:
| State | Border Color | Description |
|---|---|---|
| Currently Active | Blue | Provider in the config file (non-routing mode) |
| Routing Active | Green | Provider actually used by routing |
| Normal | Default | Unused provider |
When disabling routing, CC Switch will:
When switching providers in routing mode:
This is a major advantage of routing mode: provider switching takes effect instantly.
When switching providers without routing:
Multiple apps can be routed simultaneously, each managed independently:
Enable routing + log recording to monitor API usage.
With routing enabled, switching providers does not require restarting CLI tools.
Enabling routing is a prerequisite for using the failover feature.
Routing adds minimal latency (typically < 10ms), negligible for most scenarios.
In routing mode, CLI tools must be able to access the local routing address.
Before enabling routing, CC Switch backs up the original configuration and restores it when disabled.
Check:
Possible causes:
Solutions: