HridaSpro Docs

Api Reference

Responses Compaction

Shrink a long Responses API conversation into a compacted item list plus an encrypted summary.

API console
POST/v1/responses/compact
Bash
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." }    ]  }'
JSON
{  "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

ParameterTypeRequiredDescription
modelstringRequiredA model that supports compaction.
inputstring or arrayConditionalThe conversation to compact: a string, or an array of message and tool items. Send input or previous_response_id.
previous_response_idstringConditionalCompact the conversation that ends at this response, instead of sending input. Send input or previous_response_id.
instructionsstringOptionalA system or developer message to apply while compacting.
service_tierstringOptionalThe service tier to run on. See Service Tiers.
prompt_cache_keystringOptionalGroups 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

FieldTypeDescription
idstringUnique identifier for the compacted response.
objectstringAlways response.compaction.
created_atintegerUnix timestamp of when the compaction was created.
outputarrayYour user messages, followed by a single compaction item. Use this array as the start of input in your next request.
usageobjectToken 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:

JSON
{  "error": {    "message": "Request blocked by guardrail: sensitive_information_disclosure",    "type": "guardrail_block",    "code": "GUARDRAIL_BLOCKED"  }}