Skip to main content
POST
/
v1
/
responses
/
compact
Compact a Responses conversation
curl --request POST \
  --url https://api.aiohub.org/v1/responses/compact \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "input": "<string>",
  "instructions": "<string>",
  "previous_response_id": "<string>"
}
'
{
  "id": "<string>",
  "object": "response.compaction",
  "created_at": 123,
  "output": [
    {}
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 123,
      "text_tokens": 123,
      "audio_tokens": 123,
      "image_tokens": 123
    },
    "completion_tokens_details": {
      "text_tokens": 123,
      "audio_tokens": 123,
      "reasoning_tokens": 123
    }
  },
  "error": {}
}

Authorizations

Authorization
string
header
required

API key (sk-xxx)

Body

application/json
model
string
required
input

Input content. Can be a string or an array of messages.

instructions
string
previous_response_id
string

Response

200 - application/json

Conversation compacted successfully

id
string
object
string
Example:

"response.compaction"

created_at
integer
output
object[]
usage
object
error
object