Responses

Compact conversation

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.

Example response

{
  "id": "resp_001",
  "object": "response.compaction",
  "output": [
    {
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Summarize our launch checklist from last week."
        }
      ]
    },
    {
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "You are performing a CONTEXT CHECKPOINT COMPACTION..."
        }
      ]
    },
    {
      "type": "compaction",
      "id": "cmp_001",
      "encrypted_content": "encrypted-summary"
    }
  ],
  "created_at": 1731459200,
  "usage": {
    "input_tokens": 42897,
    "output_tokens": 12000,
    "total_tokens": 54912
  }
}

Changes

Changed in 29 of the 163 revisions of this API.1123172

    • ○

      added the non-success response with the status

      response-non-success-status-added

    • ○

      added the new gpt-rosalind-research enum value to the request property /////

      request-property-enum-value-added

    • ○

      added the new gpt-6-luna enum value to the request property /////////

      request-property-enum-value-added

    • ○

      added the new gpt-6-sol enum value to the request property /////////

      request-property-enum-value-added

    • ○

      added the new gpt-5.1-mini enum value to the request property /////////

      request-property-enum-value-added

    • ○

      api tag Responses added

      api-tag-added

    • ○

      request property //////////// deprecated

      request-property-deprecated

    • ○

      request property //////////// deprecated

      request-property-deprecated

    • ○

      response property output/items/oneOf[AdditionalTools]/tools/items/oneOf[subschema #6: MCP tool]/connector_id deprecated

      response-property-deprecated

    • ○

      response property output/items/oneOf[ToolSearchOutput]/tools/items/oneOf[subschema #6: MCP tool]/connector_id deprecated

      response-property-deprecated

  • 087f9c841f6512See the full diff
    • ▲

      removed the enum value gpt-5.1-mini of the request property /////////

      request-property-enum-value-removed

    • ○

      added the new gpt-audio-mini enum value to the request property /////////

      request-property-enum-value-added

    • ○

      added the new gpt-audio-mini-2025-12-15 enum value to the request property /////////

      request-property-enum-value-added

    • ○

      the ////// request property's maxLength was increased from 20971520 to 104857600

      request-property-max-length-increased

  • 2f07cb0091b426See the full diff
    • ▲

      removed subschema #1 subschema #2 from the ////// request property anyOf list

      request-property-any-of-removed

    • ▲

      added to the / response property oneOf list for the response status

      response-property-one-of-added

    • ○

      added the new optional request property //////

      new-optional-request-property

    • ○

      added the new optional request property //////

      new-optional-request-property

    • ○

      added the new optional request property //////

      new-optional-request-property

    • ○

      added the new optional request property //////

      new-optional-request-property

    • ○

      added subschema #1 to the ////// request property anyOf list

      request-property-any-of-added

    • ○

      removed from the / response property oneOf list for the response status

      response-property-one-of-removed

    This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 1c7ab009623711See the full diff
    • ▲

      added to the / response property oneOf list for the response status

      response-property-one-of-added

    • ○

      removed from the / response property oneOf list for the response status

      response-property-one-of-removed