v32

latestOpenAPI 3.1.0MITraw.githubusercontent.com2026-07-312881,4162.7 MB

Compact a response

Compact a conversation. Returns a compacted response object.

Learn when and how to compact long-running conversations in the conversation state guide. For ZDR-compatible compaction details, see Compaction (advanced).

post/responses/compact

Request body

previous_response_idstring nullable

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state. Cannot be used in conjunction with conversation.

instructionsstring nullable

A system (or developer) message inserted into the model's context. When used along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.

prompt_cache_keystring nullable

A key to use when reading from or writing to the prompt cache.

prompt_cache_retention'in_memory' | '24h'
service_tier'auto' | 'default' | 'fast' | 'flex' | 'priority'

Response

Success

idstring required

The unique identifier for the compacted response.

object'response.compaction' required

The object type. Always response.compaction.

created_atinteger required

Unix timestamp (in seconds) when the compacted conversation was created.