curl https://spro.hridaai.com/v1/responses/compact \ -H "Content-Type: application/json" \ -H "Authorization: Bearer spro-xxxxxxxxxxxxxxxx" \ -d '{ "model": "gpt-5", "input": [ { "role": "user", "content": "Help me plan a three day trip to Lisbon." }, { "role": "assistant", "content": "Day 1: Alfama and the castle. Day 2: Belem. Day 3: Sintra." }, { "role": "user", "content": "Move Sintra to day 2 and keep the rest." } ] }'{ "id": "resp_6890c1a3f2b4", "object": "response.compaction", "created_at": 1745270400, "output": [ { "type": "message", "role": "user", "content": [{ "type": "input_text", "text": "Help me plan a three day trip to Lisbon." }] }, { "type": "message", "role": "user", "content": [{ "type": "input_text", "text": "Move Sintra to day 2 and keep the rest." }] }, { "type": "compaction", "id": "cmp_6890c1a3f2b4", "encrypted_content": "gAAAAAB..." } ], "usage": { "input_tokens": 96, "output_tokens": 41, "total_tokens": 137 }}POST https://spro.hridaai.com/v1/responses/compact
Compacts a long conversation. You send the conversation so far, and get back a shorter list of items: your user messages, followed by one compaction item that holds an encrypted summary of everything else. Pass that list as input to later Responses API calls to keep going without resending the full history. OpenAI-compatible, so you can use the OpenAI SDK with the Spro base URL. Non-streaming only.
Only models that support compaction are served. Any other model returns 400 with the code unsupported_api_surface.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | A model that supports compaction. |
input | string or array | Conditional | The conversation to compact: a string, or an array of message and tool items. Send input or previous_response_id. |
previous_response_id | string | Conditional | Compact the conversation that ends at this response, instead of sending input. Send input or previous_response_id. |
instructions | string | Optional | A system or developer message to apply while compacting. |
service_tier | string | Optional | The service tier to run on. See Service Tiers. |
prompt_cache_key | string | Optional | Groups requests so the provider can reuse its prompt cache. |
If you send neither input nor previous_response_id, the request fails with 400. Sampling parameters (temperature, top_p, penalties) are not accepted by this endpoint and are removed before the upstream call.
The compaction object
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the compacted response. |
object | string | Always response.compaction. |
created_at | integer | Unix timestamp of when the compaction was created. |
output | array | Your user messages, followed by a single compaction item. Use this array as the start of input in your next request. |
usage | object | Token counts for the compaction pass: input_tokens, output_tokens, total_tokens. |
The compaction item holds an encrypted summary (encrypted_content). It is not readable text, and you should pass it back unchanged.
Guardrails
Input guardrails scan the text in input exactly as they do for the Responses API. The result contains your original messages plus an encrypted summary and no newly written text, so there is nothing for the output pass to check, and it logs usage only. A blocked input returns 403 Forbidden:
{ "error": { "message": "Request blocked by guardrail: sensitive_information_disclosure", "type": "guardrail_block", "code": "GUARDRAIL_BLOCKED" }}