v1

latestOpenAPI 3.1.0Apache 2.02026-07-264001921002.3 KB
Compaction

Compact context

Compresses a conversation into an opaque encrypted compaction item using the OpenAI-compatible context compaction API.

The response output array contains the original user messages plus a final item with type: "response.compaction" and an encrypted_content field. Pass the full output array as input to future Responses API requests to continue the conversation without retransmitting the full history.

Supported providers: OpenAI, Azure OpenAI, xAI. Requests to unsupported providers return a 400 error.

post/v1/responses/compact

Request body

modelstring required

Model in provider/model format (e.g., "openai/gpt-4o")

instructionsstring

System instructions that persist across the compacted context.

previous_response_idstring

ID of a previous response to extend rather than sending full input.

prompt_cache_keystring
prompt_cache_retentionstring
service_tierstring
fallbacksstring[]

Fallback model list in provider/model format.

Response

Successful compaction response

idstring
objectstring

Always "response.compaction"

modelstring
created_atinteger

Example response

{
  "object": "response.compaction"
}