Claude Desktop with CodeGateway (Third-Party Gateway Setup)

Point Claude Desktop inference at CodeGateway: connection settings, the model-picker lineup (inferenceModels), and how to declare 1M context correctly.

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

https://api.codegateway.dev (no /v1 suffix)

Credential kind

Static API key

Gateway auth scheme

Bearer (x-api-key also works)

Gateway API key

your sk-cg- key

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:

json
[
{ "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 }
]
name must match the id /v1/models returns exactly. A bare alias such as sonnet will not work — aliases do not fold into a 1M variant here. inferenceModels lives in managed configuration (an MDM profile, a bootstrapUrl response, 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

supports1m

claude-sonnet-5-5

1M

yes

claude-opus-5-5

1M

yes

claude-fable-5-1 / claude-fable-5

1M

yes

claude-sonnet-5 / claude-opus-5

1M

yes

claude-sonnet-4-6 / claude-opus-4-8 / claude-haiku-4-5

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

bash
curl -s https://api.codegateway.dev/v1/models \
-H "Authorization: Bearer sk-cg-YOUR_KEY" | head -c 400

Then send a minimal request to CodeGateway's Anthropic endpoint:

bash
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.

Turn this doc into a real API call

Create an sk-cg- key after signing up, point your base URL at CodeGateway, and keep your existing SDK or CLI unchanged. Pay per token; binding a card adds $2 of credit.

Sign up free
Author:CodeGateway Team