apicheats.dev openai/llms.txt Raw .md
POST

POST /responses/compact?beta=true — OpenAI API

Beta

OpenAI API key (required); https://api.openai.com/v1

OpenAI API

Compact conversation

Base URL
https://api.openai.com/v1
Auth
Authorization: Bearer <OPENAI_API_KEY>
Last verified
2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 379 tokens · Vary: Accept

Critical gotchas

The Responses API is the primary interface for new text and tool workflows; Chat Completions remains a separate compatibility API.

Audio transcription uploads use multipart form data rather than a JSON request body.

cURL

curl -X POST 'https://api.openai.com/v1/responses/compact?beta=true' \  -H "Authorization: Bearer $OPENAI_API_KEY" \  -H 'Content-Type: application/json' \  -H 'openai-beta: responses_multi_agent=v1' \  -d '{  "model": "gpt-6-astra"}'

Parameters

Name In Type Required Description
model body string Yes Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models.
input body string No Text, image, or file inputs to the model, used to generate a response
previous_response_id body string No The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.
instructions body string No 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_key body string No A key to use when reading from or writing to the prompt cache.
prompt_cache_retention body string No Request body field prompt_cache_retention.
prompt_cache_options body object No Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details.
service_tier body string No Request body field service_tier.

Response 200 OK

{
  "id": "resp_001",
  "object": "response.compaction",
  "output": [
    {
      "id": "msg_001",
      "status": "completed",
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Summarize our launch checklist from last week."
        }
      ]
    },
    {
      "id": "msg_002",
      "status": "completed",
      "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,
    "input_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0
    },
    "output_tokens": 12000,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 54897
  }
}
Get a free OpenAI API key → sponsored

Affiliate link - we may earn a commission, at no extra cost to you.