Follow Discord
Sweep 03 Nov 2026 · 22:27Z Build v2.1.318 536 read Stable v2.1.311 Latest v2.1.318 Next v2.1.318 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

compaction-threshold changedbuild-with-claude/compaction-threshold

Recorded here
Lines+57added
Lines−4removed
From line 7 where the diff opens
First seen 21 Sep 2026 this site's first read of the page
Recorded edits23to this page, all time

## Availability ### API support #### [Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) #### [Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) ### Required beta headers ### Data handling

The whole hunk

from line 7, old and new numbered
/
lines
from line 7
77 betaHeader: compact-2026-01-12
88 zdr:
99 eligibility: eligible
10 note: Excludes [Covered Models](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#model-specific-data-retention-requirements).
10 note: Excludes [Covered Models](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#model-specific-data-retention-requirements). Server-side compaction results are returned and round-tripped statelessly through the API response.
1111 supportedModels:
1212 - claude-fable-5-1
1313 - claude-mythos-5-1
from line 16
1616 - claude-mythos-preview
1717 - claude-opus-5-5
1818 - claude-opus-5
19 - claude-sonnet-5-5
20 - claude-sonnet-5
21 - claude-haiku-5-5
1922 - claude-opus-4-8
2023 - claude-opus-4-7
2124 - claude-opus-4-6
22 - claude-sonnet-5-5
23 - claude-sonnet-5
2425 - claude-sonnet-4-6
25 - claude-haiku-5-5
2626 supportedPlatforms:
2727 Claude API: beta
2828 Claude Platform on AWS: beta
2929 Amazon Bedrock: beta
30 Amazon Bedrock (InvokeModel): beta
3031 Claude Models on Google Cloud (Google managed): beta
3132 Microsoft Foundry: beta
3233---
3334 
35**API support**: Usage differs by product.
36 
37* **Messages API**: Opt in with a `compact_20260112` edit; compaction starts at 150,000 input tokens by default.
38* **Managed Agents**: Always on. It compacts the session’s conversation history to fit the context window.
39 
3440Threshold compaction is the automatic kind of compaction: you set a token threshold on your ordinary requests, and the API summarizes older context partway through a request once the threshold is reached. It is supported alongside on-demand compaction, where you decide when the summary is written (see [Compaction on demand](https://platform.claude.com/docs/en/build-with-claude/compaction-on-demand)). To choose between them, see [Choose how to compact](https://platform.claude.com/docs/en/build-with-claude/compaction#choose-how-to-compact).
3541 
3642Compaction extends the effective context length for long-running conversations and tasks by automatically summarizing older context when approaching the context window limit. It also keeps the active context small: as a conversation grows, response quality degrades, so compaction replaces older content with a concise summary.
from line 3390
33843390 Explore a practical implementation that manages long-running conversations with instant session memory compaction using background threading and prompt caching.
33853391 </Card>
33863392</CardGroup>
3393 
3394## Availability
3395 
3396Threshold compaction is in beta on select models and eligible for zero data retention.
3397 
3398### API support
3399 
3400#### [Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages)
3401 
3402* Availability: Available
3403* Usage: Opt in with a `compact_20260112` edit in `context_management.edits`. Compaction starts when input tokens reach the trigger, 150,000 by default and at least 50,000.
3404 
3405| Status | Cloud platforms | Models |
3406| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3407| Beta | Claude API, [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws), [Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock), [Amazon Bedrock (InvokeModel)](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy), [Claude Models on Google Cloud (Google managed)](https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/google-managed), [Microsoft Foundry](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry) | [Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/overview), [Claude Mythos 5.1](https://platform.claude.com/docs/en/models/mythos-5-1/overview), [Claude Fable 5](https://platform.claude.com/docs/en/models/fable-5/overview), [Claude Mythos 5](https://platform.claude.com/docs/en/models/mythos-5/overview), Claude Mythos Preview, [Claude Opus 5.5](https://platform.claude.com/docs/en/models/opus-5-5/overview), [Claude Opus 5](https://platform.claude.com/docs/en/models/opus-5/overview), [Claude Sonnet 5.5](https://platform.claude.com/docs/en/models/sonnet-5-5/overview), [Claude Sonnet 5](https://platform.claude.com/docs/en/models/sonnet-5/overview), [Claude Haiku 5.5](https://platform.claude.com/docs/en/models/haiku-5-5/overview), [Claude Opus 4.8](https://platform.claude.com/docs/en/models/opus-4-8/overview), [Claude Opus 4.7](https://platform.claude.com/docs/en/models/opus-4-7/overview), [Claude Opus 4.6](https://platform.claude.com/docs/en/models/opus-4-6/overview), [Claude Sonnet 4.6](https://platform.claude.com/docs/en/models/sonnet-4-6/overview) |
3408 
3409#### [Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview)
3410 
3411* Availability: Always on
3412* Usage: It compacts the session’s conversation history to fit the context window, and each compaction emits an `agent.thread_context_compacted` event.
3413 
3414| Status | Cloud platforms | Models |
3415| ------ | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3416| Beta | Claude API, [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws) | [Claude Fable 5.1](https://platform.claude.com/docs/en/models/fable-5-1/overview), [Claude Mythos 5.1](https://platform.claude.com/docs/en/models/mythos-5-1/overview), [Claude Fable 5](https://platform.claude.com/docs/en/models/fable-5/overview), [Claude Mythos 5](https://platform.claude.com/docs/en/models/mythos-5/overview), Claude Mythos Preview, [Claude Opus 5.5](https://platform.claude.com/docs/en/models/opus-5-5/overview), [Claude Opus 5](https://platform.claude.com/docs/en/models/opus-5/overview), [Claude Sonnet 5.5](https://platform.claude.com/docs/en/models/sonnet-5-5/overview), [Claude Sonnet 5](https://platform.claude.com/docs/en/models/sonnet-5/overview), [Claude Haiku 5.5](https://platform.claude.com/docs/en/models/haiku-5-5/overview), [Claude Opus 4.8](https://platform.claude.com/docs/en/models/opus-4-8/overview), [Claude Opus 4.7](https://platform.claude.com/docs/en/models/opus-4-7/overview), [Claude Opus 4.6](https://platform.claude.com/docs/en/models/opus-4-6/overview), [Claude Sonnet 4.6](https://platform.claude.com/docs/en/models/sonnet-4-6/overview) |
3417 
3418### Required beta headers
3419 
3420[Beta headers overview](https://platform.claude.com/docs/en/api/beta-headers)
3421 
3422Beta headers allow you to access experimental features and new model capabilities before they become part of the standard API.
3423 
3424| Header | APIs |
3425| -------------------- | ------------------------------------------------------------------------------------------- |
3426| `compact-2026-01-12` | [Messages API](https://platform.claude.com/docs/en/build-with-claude/working-with-messages) |
3427 
3428### Data handling
3429 
3430[Data handling overview](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#feature-eligibility)
3431 
3432| Item | Zero data retention | HIPAA |
3433| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
3434| Status | Eligible (excludes [Covered Models](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#model-specific-data-retention-requirements)) | Not eligible |
3435| Details | Server-side compaction results are returned and round-tripped statelessly through the API response. | — |
3436 
3437Applicable endpoints:
3438 
3439* `/v1/messages` with `context_management`
33873440 
Feedback