Skip to main content
POST /v1/responses/compact Send a compaction-capable model and complete context as input; instructions is a common optional field. This is a non-streaming request. Setting stream: true does not enable SSE. Confirm provider extensions separately for each channel. The response contains object: response.compaction, output, and optional usage. Output includes compaction items and may retain messages or other items. Replay the complete output and do not use the ordinary Responses status field to detect success. Preserve encrypted content unchanged. The gateway DTO accepts previous_response_id, but upstream state resolution determines support. The example supplies history explicitly and does not promise cross-channel ID continuation, general resource retrieval, or automatic compaction. Compaction and continuation example · Create a response 阅读中文

Authorizations

Authorization
string
header
required

模型调用 API Key,不是控制台登录凭据 / Model API key, not console login credentials

Body

application/json
model
string
required

模型列表返回的原始 ID;需要支持当前接口 / Exact ID from the model list; must support this endpoint

Example:

"YOUR_MODEL_ID"

input

文本或输入项数组;内容块和工具项需模型支持 / Text or input items; content blocks and tool items require model support

instructions
string

本次压缩指令;续聊时再次明确发送所需指令 / Instructions for this compaction; explicitly send needed instructions again when continuing

previous_response_id
string

DTO 接收但状态解析依赖上游;建议显式历史 / Accepted by the DTO but state resolution requires upstream support; prefer explicit history

Response

成功结构仍需检查业务字段 / Check business fields even on HTTP success

object
enum<string>
required
Available options:
response.compaction
output
object[]
required

下一轮完整上下文窗口,保留所有条目及顺序 / Complete next context window; retain all items and their order

id
string
created_at
number
usage
object | null