Context
Trim Context
Deterministically trim a conversation payload (no LLM calls).
POST
curl
Keep the last N messages and/or fit a heuristic token budget, optionally dropping tool parts
from what is kept (tool parts are stripped before the budget is applied). Returns the trimmed
messages plus before/after stats.
With no constraints set, the messages are returned unchanged and only the stats are computed -
a deliberate, cheap “how big is my context?” probe (no LLM call, no mutation).
Required ACL:
searchAuthorizations
Body
application/json
Deterministic trim request (no LLM calls).
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.
Last modified on October 12, 2026