Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-docs

Deploy Claude Desktop on 3P with an LLM gateway changedthird-party/claude-desktop/gateway

Nearest release: v2.1.329, published under an hour 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 19 Nov 2026 17:56 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 19 Nov 2026 18:07 UTC.

Upstream edited
Recorded here
Lines+23added
Lines−5removed
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

#### Context window for unrecognized model IDs

The whole hunk

from line 505, old and new numbered
/
lines
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 `supports1m: true` on its entry, as described under [Model list and default model](https://claude.com/docs/third-party/claude-desktop/models.md#model-list-and-default-model).
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).
509509 
510510### Context window and compaction
511511 
512Cowork 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:
512Chat, 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:
513513 
514514* **Standard entry**: 1M tokens for a model the session recognizes as having a native 1M context window, as listed under [the context window behind a gateway](https://code.claude.com/docs/en/model-config#context-window-behind-a-gateway) in the Claude Code documentation, and 200K tokens for every other model ID, including an ID the session doesn't recognize whose `inferenceModels` entry doesn't set [`behavesAs`](https://claude.com/docs/third-party/claude-desktop/models#map-an-unrecognized-model-id-to-a-claude-model). On Claude Desktop versions earlier than 2.19675.0, a session assumes 200K tokens on this entry for every model.
515515* **1M context window entry**, or the single entry from `prefer1m` or `modelPrefer1mContext`: 1M tokens, regardless of the model ID.
516516 
517If the gateway or the provider accepts less than the window a session assumes, requests past that limit fail. The session then compacts and retries only when the provider's too-long error reaches it unchanged. To make sessions compact earlier than the window they assume, for example when your provider serves a natively 1M model with only a 200K window, see [Set the auto-compact window](https://code.claude.com/docs/en/model-config#set-the-auto-compact-window) in the Claude Code documentation. For a model ID the session doesn't recognize, see [Correct the window for a gateway or custom model ID](https://code.claude.com/docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id).
517If the gateway or the provider accepts less than the window a session assumes, requests past that limit fail. The session then compacts and retries only when the provider's too-long error reaches it unchanged. To make sessions compact earlier than the window they assume, for example when your provider serves a natively 1M model with only a 200K window, see [Set the auto-compact window](https://code.claude.com/docs/en/model-config#set-the-auto-compact-window) in the Claude Code documentation. For a model ID the session doesn't recognize, see [Context window for unrecognized model IDs](#context-window-for-unrecognized-model-ids).
518518 
519519The following table lists what the model configuration and the gateway need to provide so that sessions use the full context window and compact when they reach it, and how to check each requirement.
520520 
521521| Requirement | What fails without it | How to check |
522522| - | - | - |
523| Set `supports1m`, or mark the model in discovery (see [Models](#models)), for each model your provider serves with a 1M-token context window but a session assumes 200K tokens for. Also accept the `context-1m-2025-08-07` value in the `anthropic-beta` request header. | Sessions on such a model's standard picker entry assume a 200K-token window, even when the provider accepts 1M. A gateway that rejects the header value fails every request made from the **1M context window** entry. | From a session on the **1M context window** entry, confirm in the gateway's logs that requests carry the header value and that requests above 200K input tokens succeed. |
523| [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. |
524524| [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. |
525525| 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. |
526526| [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. |
from line 527
527527 
528528On 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.
529529 
530#### Context window for unrecognized model IDs
531 
532A session assumes a 200K-token window for a model ID that it doesn't recognize, such as a routing alias whose `inferenceModels` entry doesn't set `behavesAs`, even when your provider accepts more. It compacts a long conversation near 200K tokens. If the summary request fails, the turn stops with `Prompt is too long`. The session doesn't send the request for Claude's reply to your gateway, even when your provider would accept it. For what users see and can do, see [`Your context window is full`](#troubleshoot) under Troubleshoot.
533 
534If the model behind the ID accepts more than 200K tokens, declare its window:
535 
536* **In your configuration**, for a model that accepts 1M-token requests: [set a larger context window for the model](https://claude.com/docs/third-party/claude-desktop/models.md#set-a-larger-context-window-for-a-model).
537* **On each device**, for a window other than 1M tokens: set [`CLAUDE_CODE_MAX_CONTEXT_TOKENS`](https://code.claude.com/docs/en/model-config#which-ids-claude_code_max_context_tokens-applies-to) to the window in tokens, such as `500000`, in the `env` block of [Claude Code managed settings](https://code.claude.com/docs/en/settings#settings-files). It changes the window only where a session would assume 200K tokens for an ID that it doesn't recognize. It does that for every such ID on the device, so use the smallest window among the models behind them. If the device already has Claude Code managed settings, add the variable to those settings and leave [`parentSettingsBehavior`](https://claude.com/docs/third-party/claude-desktop/code#interaction-with-claude-code%E2%80%99s-own-managed-settings) as it is, set or unset. If the device has none yet, also set `parentSettingsBehavior` to `"merge"` in the settings that you create.
538 
539A [Claude apps gateway](https://code.claude.com/docs/en/claude-apps-gateway) doesn't accept `inferenceModels` in its policy's `desktop` block, so you can't set `behavesAs` or `prefer1m` on a model there. For the gateway's own ways to offer the 1M context window, see [Extended context in Claude Desktop](https://code.claude.com/docs/en/claude-apps-gateway-config#extended-context-in-claude-desktop) in the Claude Code documentation.
540 
530541### Gateway requirements for preserved thinking
531542 
532543On models with [preserved thinking](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking), the provider ties each thinking block that Claude produces to the `system`, `tools`, and `messages` content that came before it. A session sends the thinking blocks from earlier turns back in later requests. That content can change after Claude produces a block, for example in your gateway or after a Claude Desktop update. If it has changed, the provider can reject the request with a `400` whose message says that the block is `bound to a different conversation`.
from line 751
740751 
741752**The 1M context window entry does not appear in the picker.** `supports1m` takes effect only when the entry's `name` matches the model ID the picker uses. Setting it on a bare alias (for example `sonnet`) while discovery returns full model IDs produces no match. Set `supports1m` on an entry whose `name` is the exact ID your gateway's `/v1/models` endpoint returns. With `prefer1m` or `modelPrefer1mContext` set, a model whose `name` matches has one entry and no **1M context window** label.
742753 
743**`Your context window is full` in a Code session, or `Couldn’t compact this conversation to free up space. Try again, or start a new session.` in a Cowork session.** The app shows these when Claude Code reports `Prompt is too long · automatic compaction failed: …`, meaning a session tried to compact the conversation and the summary request failed. On Claude Desktop versions earlier than 2.37337, a Cowork session shows `This conversation is too long to continue. Start a new session, or remove some tools to free up space.` for the same failure. The conversation isn't lost. After you fix the cause, the user's next message in the same session retries compaction. The error the summary request returned is in the gateway's logs as the response to the session's last `POST /v1/messages` request before the failure. Match it to a cause as follows.
754**`Your context window is full`.** The app shows this card when Claude Code reports `Prompt is too long · automatic compaction failed: …`. A session tried to shorten the conversation by summarizing it (compacting), and the summary request failed. In Chat and Cowork, the card also reads `Couldn’t compact this conversation to free up space. Try again, or start a new session.` On Claude Desktop versions earlier than 2.37337, a Cowork session shows `This conversation is too long to continue. Start a new session, or remove some tools to free up space.` for the same failure. The conversation isn't lost:
744755 
756* **Code**: before the card appears, the session runs `/compact` itself, up to two times. If one run succeeds, Claude continues with no action from the user.
757* **Chat and Cowork**: after you fix the cause, **Try again** compacts the conversation and finishes the stopped turn. While summary requests still fail, **Go back** removes the user's last message and puts its text back in the message box, so the user can go on with a smaller request.
758 
759After you fix the cause, the user's next message in the same session also retries compaction. The error the summary request returned is in the gateway's logs as the response to the session's last `POST /v1/messages` request before the failure. Match it to a cause as follows.
760 
745761* **A timeout, `504`, or `524`**: a proxy or load balancer on the route closed the summary response before it finished. See the streaming requirement in [Context window and compaction](#context-window-and-compaction).
746762* **`401`, `402`, or `403`**: the gateway credential expired, or the gateway's quota for the user is spent. Have the user sign in again or issue a new key, or raise the quota.
747763* **`API returned an empty or malformed response`**: after certain streaming failures, such as a stream that stops partway, Claude Code sends the summary request again with the `stream` field set to `false`. This message means that the non-streaming request got a success status but a body that wasn't a Messages API response, for example an empty body, an HTML page, a stream of server-sent events, or JSON in another format. Find that request in the gateway's logs and check what the gateway returned for it. If the request isn't in the logs, something in front of the gateway, such as a proxy, firewall, or sign-in page, answered it.
748764* **`400` with your gateway's own error text**: the gateway rejected the summary request itself, for example on a request-size or token limit of its own. Raise or remove that limit for these requests.
765 
766On a routing alias or another model ID that sessions don't recognize, a session compacts near 200K tokens, even when your provider accepts more. To declare a larger window, see [Context window for unrecognized model IDs](#context-window-for-unrecognized-model-ids). Then have the user relaunch Claude Desktop and start a new session. If you already set `supports1m` or marked the model, check that your gateway accepts the header value, as described in [Context window and compaction](#context-window-and-compaction).
749767 
750768For `Prompt is too long` without `automatic compaction failed`, or your gateway's own request-too-large error shown in the session, check the `usage` and error-forwarding requirements in [Context window and compaction](#context-window-and-compaction) first. [Prompt is too long](https://code.claude.com/docs/en/errors#prompt-is-too-long) in the Claude Code error reference covers the other causes.
751769 
Feedback