Add a new routing mode that lets users manually bind a specific application to a specific credential while preserving the existing automatic routing behavior.
Examples:
- Codex -> ChatGPT account A
- Claude Code -> Claude account B
- OpenClaw -> API key C
- Multiple apps -> same account or key
automatic: keep current behavior. Requests follow existing route-specific priority and account rotation.app-assigned: resolve the calling application first. If a matching binding exists, try that credential before falling back to the existing automatic flow.
codexclaude-codegemini-cliopenclawunknown-openai-clientunknown-anthropic-client
chatgpt-accountclaude-accountapi-key
Stored in ~/.cligate/settings.json.
{
"routingMode": "app-assigned",
"appRouting": {
"codex": {
"enabled": true,
"bindingType": "chatgpt-account",
"bindingId": "user@example.com",
"fallbackToDefault": true
}
}
}- Detect app from request path and headers.
- If routing mode is
automatic, use existing logic unchanged. - If routing mode is
app-assignedand the app has an enabled binding:- Resolve the bound credential.
- If usable, route request through that credential only.
- If unavailable and
fallbackToDefault=true, continue with existing automatic logic. - If unavailable and
fallbackToDefault=false, return an explicit error.
codex:/responses,/v1/responses,/backend-api/codex/*gemini-cli:/v1beta/models/*claude-codeandopenclawboth use Anthropic-compatible routes. Detection uses known headers and falls back tounknown-anthropic-clientwhen the source is ambiguous.- Generic OpenAI-compatible traffic falls back to
unknown-openai-client.
Settings page exposes:
- Routing mode toggle
- Per-app binding enable switch
- Binding type select
- Binding target select
- Fallback-to-default switch
- Existing settings remain valid.
- Existing automatic routing remains the default.
- Invalid assignments are rejected by the settings API.