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:47 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 2 Dec 2026 00:07 UTC.

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

#### Compaction in Code sessions on 1M models

The whole hunk

from line 551, old and new numbered
/
lines
from line 551
551551* **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.
552552* **1M context window entry**, or the single entry from `prefer1m` or `modelPrefer1mContext`: 1M tokens, regardless of the model ID.
553553 
554If 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).
554If 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, 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). For the size at which a Code session compacts on a 1M model, see [Compaction in Code sessions on 1M models](#compaction-in-code-sessions-on-1m-models).
555555 
556The 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.
556The following table lists what the model configuration and the gateway need to provide so that sessions can use the full context window and can compact, and how to check each requirement.
557557 
558558| Requirement | What fails without it | How to check |
559559| - | - | - |
from line 563
563563| [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.
566 
567#### Compaction in Code sessions on 1M models
568 
569By default, a Code session compacts at an auto-compact window that Anthropic tunes per model. On a model ID that contains the name of a current model with a native 1M context window, such as `bedrock/us.anthropic.claude-opus-5`, a Code session compacts near 400K tokens. For the sessions that compact at a larger size, such as scheduled tasks, see [Sessions that run past 400K by default](https://code.claude.com/docs/en/model-config#sessions-that-run-past-400k-on-auto) in the Claude Code documentation. On Claude Desktop versions earlier than 18.19841.1, a Code session on these models compacts near the [context window that the session assumes](#context-window-and-compaction).
570 
571To let Code sessions use the full 1M tokens, add a `modelSettings` entry for each model version to [Claude Code managed settings](https://code.claude.com/docs/en/settings#settings-files) on each device. For the entry's format, see [Compaction near 400K on a 1M model](https://code.claude.com/docs/en/model-config#compaction-near-400k-on-a-1m-model) in the Claude Code documentation. Add the entries according to what the device has:
572 
573* **The device already has Claude Code managed settings**: add the entries 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.
574* **The device has no Claude Code managed settings yet**: also set `parentSettingsBehavior` to `"merge"` in the settings that you create, so that the policy from Claude Desktop still applies.
566575 
567576#### Context window for unrecognized model IDs
568577 
Feedback