Follow Discord
Sweep 03 Dec 2026 · 19:13Z Build v2.1.336 553 read Stable v2.1.332 Latest v2.1.336 Next v2.1.336 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.334, published 4 hours before 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 1 Dec 2026 23:02 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 1 Dec 2026 23:07 UTC.

Upstream edited
Recorded here
Lines+16added
Lines−4removed
From line 557 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits75to this page, all time

The whole hunk

from line 557, old and new numbered
/
lines
from line 557
557557 
558558| Requirement | What fails without it | How to check |
559559| - | - | - |
560| [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. |
560| [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 remove the value, 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. |
561561| [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. |
562562| 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. |
563| [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. |
563| [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 doesn't compact. | Send an oversized request through the gateway and confirm that the client receives the provider's status code and error body. |
564564 
565565The 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.
566566 
from line 582
582582On these models, your gateway needs to do the following:
583583 
584584* **Forward the request content unchanged**: send `system`, `tools`, and `messages` to the provider as the session sent them, including the [attribution block](https://code.claude.com/docs/en/llm-gateway-protocol#system-prompt-attribution-block) that Claude Code puts first in the `system` array. To check, compare these fields in the request that the gateway received and in the one that it sent to the provider. Apart from `cache_control` markers, their content should be identical.
585* **Forward the rejection unchanged**: when the provider's status code and error body reach the session unchanged, the session removes the earlier thinking blocks and retries. The user sees only the reply. If your gateway rewrites the error, the user can see the error, and later messages in that conversation can fail the same way. To check, see the error-forwarding requirement in [Context window and compaction](#context-window-and-compaction).
585* **Forward the rejection unchanged**: when the provider's status code and error body reach the session unchanged, the session removes the earlier thinking blocks and retries. The user sees only the reply. To check, see the error-forwarding requirement in [Context window and compaction](#context-window-and-compaction).
586586 
587If your gateway changes the rejection's status code or replaces its message, Claude Desktop 18.19841.1 or later handles the rejection as follows:
588 
589* **A `422` that keeps the provider's message**: the session removes the earlier thinking blocks and retries. The user sees only the reply.
590* **A `400` or `422` with only your gateway's own text**: the session can [send the request two more times](https://code.claude.com/docs/en/llm-gateway-protocol#retry-unchanged-then-without-earlier-thinking), first unchanged and then without the earlier thinking blocks. If one of these requests succeeds, the user sees only the reply.
591* **Another status code, such as `403` or `500`, or an error inside a response stream that started with `200`**: the user sees the error, and each later message in the conversation fails the same way.
592 
593In these versions, on any model, a `400` or `422` with only your gateway's own text can lead to the same two requests when the refused request carries thinking blocks, even when the response carries `x-should-retry: false`. Examples are a refusal by your gateway's content filter and another provider error that your gateway rewrote, such as the too-long error.
594 
595Both requests go through your gateway, and the second one has no `thinking` or `redacted_thinking` blocks in its `messages`. A refusal at a later message can lead to two more requests. If your gateway refuses every request for one message this way, the user sees the error, which can end with `If other sessions work and this one keeps failing, start a new session.`
596 
597Keep forwarding the rejection unchanged, because the session doesn't send these two requests in every case. In earlier versions of Claude Desktop, if your gateway changes the rejection's status code or replaces its message, each later message in the conversation fails.
598 
587599### MCP tool search
588600 
589601[MCP tool search](https://code.claude.com/docs/en/mcp#scale-with-mcp-tool-search) loads MCP tool schemas on demand instead of inlining every schema into the context window. It reduces context pressure when many MCP tools are configured (sessions that otherwise compact every turn or two).
from line 834
822834 
823835For `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.
824836 
825**Every message in one conversation fails, and new conversations work.** In the gateway's logs, find the provider's response to one of the failed requests. If its message says that a thinking block is `bound to a different conversation`, compare it with the response that your gateway returned for that request. If the status code or the error body differs, see [Gateway requirements for preserved thinking](#gateway-requirements-for-preserved-thinking). Once your gateway forwards the error unchanged, the user's next message in the same conversation goes through.
837**Every message in one conversation fails, and new conversations work.** In Claude Desktop 18.19841.1 or later, the error can end with `If other sessions work and this one keeps failing, start a new session.` In Code, the user selects **View details** on the error card to see the error's text. In the gateway's logs, find the provider's response to a failed request that carries earlier thinking blocks. If its message says that a thinking block is `bound to a different conversation`, compare it with the response that your gateway returned for that request. If the status code or the error body differs, see [Gateway requirements for preserved thinking](#gateway-requirements-for-preserved-thinking). Once your gateway forwards the error unchanged, the user's next message in the same conversation goes through.
826838 
Feedback