context_management parameter asks the provider to compact a long conversation on the server. When the input grows past compact_threshold tokens, the provider summarizes the earlier context and returns it as an encrypted compaction output item.
Enable compaction
Sendcontext_management with a compaction entry:
Response format
When compaction runs,output includes a compaction item before the model’s reply:
Compaction output item
Continue the conversation
The Responses API on OpenRouter is stateless, so send the full history on every turn. Keep the returnedcompaction item in input in place of the context it replaced, followed in order by the output items that came after it, then append new messages. The provider expands the encrypted summary on the next request.
Next turn input
compaction item can read it. Send follow-up turns to the same OpenAI or Azure endpoint, for example with provider routing.