Deploy Claude Desktop on 3P with an LLM gateway changedthird-party/claude-desktop/gateway
Nearest release: v2.1.330, published 2 hours after upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 20 Nov 2026 16:57 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 20 Nov 2026 17:07 UTC.
Upstream edited
Recorded here
Lines+2added
Lines−4removed
From line
505
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits63to this page, all time
The whole hunk
from line 505, old and new numbered
/
from line 505
505505
506506If your gateway doesn't implement `GET /v1/models`, give every `inferenceModels` entry the full model ID your gateway accepts. When every entry is a full model ID, the app skips the `/v1/models` call automatically. A bare tier alias such as `sonnet` can't be resolved without discovery, so a list that contains one keeps discovery on. If discovery stays on, a gateway that answers the call with an error makes the app fall back to the `inferenceModels` list immediately. A gateway that accepts the call and hangs delays the model list by up to 10 seconds at launch.
507507
508A session assumes 200K tokens for a model ID it doesn't recognize as having a native 1M context window (see [Context window and compaction](#context-window-and-compaction)). If your deployment supports the 1M-token context window for that model, [set a larger context window for it](https://claude.com/docs/third-party/claude-desktop/models.md#set-a-larger-context-window-for-a-model).
509
510508### Context window and compaction
511509
512510Chat, Cowork, and Code sessions keep a long conversation within the model's context window by compacting it. To compact, the session sends one request that asks the model to summarize the conversation so far, then continues from the summary. Through a gateway, a session can't read the model's real context window from the provider, so it assumes one from the model ID and the picker entry:
from line 519
521519| Requirement | What fails without it | How to check |
522520| - | - | - |
523521| [Set a larger context window](https://claude.com/docs/third-party/claude-desktop/models.md#set-a-larger-context-window-for-a-model) for each model your provider serves with a 1M-token context window but a session assumes 200K tokens for. With discovery, mark the model (see [Models](#models)) and set `modelPrefer1mContext`. Where you use `supports1m` or mark the model, also accept the `context-1m-2025-08-07` value in the `anthropic-beta` request header. | Sessions on the model assume a 200K-token window, even when the provider accepts 1M. If the gateway rejects the header value with a `400` whose message contains `context-1m-2025-08-07`, the session sends the request again without the value and assumes a 200K-token window. After a `400` with only your gateway's own text, such as `upstream rejected the request`, the session doesn't send the request again, and the user's first message fails. | From a new session that uses the 1M window, confirm in the gateway's logs that requests above 200K input tokens succeed and, where you use `supports1m` or mark the model, that requests carry the header value. |
524| [Stream responses](https://code.claude.com/docs/en/llm-gateway-protocol#streaming) through without buffering, including the provider's SSE `ping` events, and set the response timeout on every proxy and load balancer on the route longer than your slowest complete response. | The summary request carries the whole conversation, and while the provider works on it, pings can be the only bytes on the connection. If a proxy buffers them, the session sees no bytes and gives up after about five minutes, and if a proxy's response timeout is shorter than the response takes, it ends the request with its own error, such as `504`. | Run a streaming request with `curl -N` against the hostname clients use and confirm that events print as they are generated, not in one burst at the end. |
522| [Stream responses](https://code.claude.com/docs/en/llm-gateway-protocol#streaming) through without buffering, including the provider's SSE `ping` events, and set the response timeout on every proxy and load balancer on the route longer than your slowest complete response. | The summary request carries the whole conversation, and while the provider works on it, pings can be the only bytes on the connection. If a proxy buffers them, the session sees no bytes, and each attempt fails after about five minutes, or later if you raised `inferenceStreamIdleTimeoutSec`. If a proxy's response timeout is shorter than the response takes, it ends the request with its own error, such as `504`. | Run a streaming request with `curl -N` against the hostname clients use and confirm that events print as they are generated, not in one burst at the end. |
525523| Return the provider's `usage` object unchanged on every response, including `cache_creation_input_tokens` and `cache_read_input_tokens`. | The session counts the conversation's tokens from the `usage` of the latest response. With the cache fields missing it undercounts, and requests reach the provider's limit before the session compacts. | Compare the `usage` object in the gateway's upstream response log with the one the client receives for the same request. They should be identical, and where the provider supports prompt caching, `cache_read_input_tokens` is above zero after the first turn. |
526524| [Forward the provider's status code and error body unchanged](https://code.claude.com/docs/en/llm-gateway-protocol#automatic-retry-and-error-forwarding) when it rejects a request. | Where the provider's too-long error is the compaction trigger, the session compacts and retries only if that error reaches it unchanged. With a rewritten error, the session shows the error and doesn't compact. | Send an oversized request through the gateway and confirm that the client receives the provider's status code and error body. |
527525
528On a response that delivers only keep-alive pings, a session accepts about five minutes of pings and then waits [`inferenceStreamIdleTimeoutSec`](https://claude.com/docs/third-party/claude-desktop/configuration#inferencestreamidletimeoutsec) seconds more for model output (300 by default, so about ten minutes in all). Raise that key if your provider needs longer than that before its first output on a large request.
526The entry for [`inferenceStreamIdleTimeoutSec`](https://claude.com/docs/third-party/claude-desktop/configuration#inferencestreamidletimeoutsec) gives how long a session waits with and without keep-alive pings. Raise that key if your provider needs longer than that before its first output on a large request.
529527
530528#### Context window for unrecognized model IDs
531529
No line in this hunk matches that.