Claude Desktop can send every inference call to a gateway you name. This page covers the CodeGateway setup end to end: connection settings, the model-picker lineup, and how to declare 1M context correctly.
1. Open the third-party inference settings
In Claude Desktop: Help > Troubleshooting > Enable Developer Mode, then Developer > Configure Third-Party Inference….
2. Connection settings
Setting | Value |
|---|---|
Inference provider | Gateway |
Gateway base URL |
|
Credential kind | Static API key |
Gateway auth scheme | Bearer ( |
Gateway API key | your |
Claude Desktop then discovers models with GET /v1/models and sends chat and Code session traffic to POST /v1/messages — both routed, metered, and billed through CodeGateway.
3. The model picker lineup
Under automatic discovery Claude Desktop keeps only ids containing claude or anthropic, so every claude-* entry in the CodeGateway catalog shows up (titled by id, subtitled "From gateway").
To control the lineup yourself — order, labels, and which entry is the default — use inferenceModels in managed configuration. It replaces discovery, and the first entry is the default:
[
{ "name": "claude-sonnet-5-5", "supports1m": true, "anthropicFamilyTier": "sonnet", "isFamilyDefault": true },
{ "name": "claude-opus-5-5", "supports1m": true, "anthropicFamilyTier": "opus", "isFamilyDefault": true },
{ "name": "claude-fable-5-1", "supports1m": true, "anthropicFamilyTier": "fable", "isFamilyDefault": true },
{ "name": "claude-sonnet-5", "supports1m": true, "anthropicFamilyTier": "sonnet" },
{ "name": "claude-opus-5", "supports1m": true, "anthropicFamilyTier": "opus" },
{ "name": "claude-opus-4-8", "anthropicFamilyTier": "opus" },
{ "name": "claude-sonnet-4-6", "anthropicFamilyTier": "sonnet" },
{ "name": "claude-haiku-4-5", "anthropicFamilyTier": "haiku", "isFamilyDefault": true }
]namemust match the id/v1/modelsreturns exactly. A bare alias such assonnetwill not work — aliases do not fold into a 1M variant here.inferenceModelslives in managed configuration (an MDM profile, abootstrapUrlresponse, or the platform's managed-settings file); what Apply locally writes is the equivalent local form.
4. 1M context: set supports1m only where it is true
supports1m is a capability assertion you make about your deployment — that it accepts 1M-token requests. Turn it on only for entries that really are 1M in the catalog:
id | Context window |
|
|---|---|---|
| 1M | yes |
| 1M | yes |
| 1M | yes |
| 1M | yes |
| 200K | no |
What happens if you get it wrong? The picker still shows a 1M variant, but the request is rejected at the gateway: CodeGateway honors the [1m] suffix only when the catalog's context_window is at least 1M, so claude-sonnet-4-6[1m] returns 400 Unsupported model. That is deliberate — it turns "the client thinks it has 1M, the model has 200K, and the job dies halfway through" into a failure at the first request.
5. Make bare tier aliases resolve to your models
When a Code session uses a bare alias such as sonnet, opus, or haiku, Claude Desktop uses anthropicFamilyTier to pick which lineup entry it stands for; when several entries share a tier, the one marked isFamilyDefault: true wins.
6. Verify
curl -s https://api.codegateway.dev/v1/models \
-H "Authorization: Bearer sk-cg-YOUR_KEY" | head -c 400Then send a minimal request to CodeGateway's Anthropic endpoint:
curl -sS https://api.codegateway.dev/v1/messages \
-H "x-api-key: sk-cg-YOUR_KEY" -H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-sonnet-5-5","max_tokens":16,"messages":[{"role":"user","content":"ping"}]}'A "type":"message" response means the path is live. The 1M window comes from the model itself — no extra switch.