The Messages API can now compact a conversation on demand on the Claude API
By Steven Van ·
Developers can now trigger context summarization themselves via a compaction parameter, instead of waiting for an automatic threshold.
The Claude API can now compact a conversation on demand, in beta behind the compact-2026-09-04 header. Sending a top-level compaction parameter on a request returns a signed compaction block summarizing the messages sent; on later requests, that block is sent first in place of those messages, and Claude sees the summary where they were.
This differs from the existing threshold-based compaction, where the API summarizes automatically partway through a request once a set threshold is reached. On-demand compaction instead lets the caller choose the moment, run the summarization request in the background while the conversation continues, and keep recent turns word for word after the summary. On models with preserved thinking, the thinking in those kept turns can stay valid after the swap. The feature is available on the Claude API only, covering Claude Fable 5.1, Claude Mythos 5.1, Claude Fable 5, Claude Mythos 5, Claude Mythos Preview, Claude Opus 5, Claude Opus 4.8, Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 5, and Claude Sonnet 4.6.