Compact Context
Summarize the older part of a conversation into a single user message via the caller’s LLM.
keepLastMessages messages is summarized; the summary is
returned as a user-role message followed by the kept tail verbatim. Your provider runs the
summary, so the provider adds the cost to your account.
A conversation too large for the summarizer’s context window is split into chunks that each fit,
summarized concurrently, then merged in a reduce pass - so payload size alone does not fail the
request. When the conversation still cannot be summarized (it needs more chunks than the server
allows, or the chunk summaries will not converge), the response is a 400, not a 500.
Two optional controls shape the output. instructions adds caller guidance inside the
server-owned prompt frame, so it steers the summary without the model echoing the wording back.
targetTokensEstimate sets a desired summary size, translated into word-count guidance.
The compaction block reports what happened: compacted is false when the payload passed
through untouched (nothing older than the kept tail), alongside chunk/pass counts and the
summarizer’s own token usage.
Required ACL: searchAuthorizations
Body
LLM-summarization request.
Your provider runs the summary, so the provider adds the cost to your account.
Response
Successful Response.
Result of a context operation, ready to feed to /completions.
Before/after accounting for a context operation.
tokens*Estimate fields are heuristic, not an authoritative provider count.
messages_dropped is the net reduction in message count (messages_before - messages_after); for compaction the summarized tail is replaced by a single summary
message, so this reflects the net change rather than a raw delete count.