Codex 上下文压缩接口
Responses API 上下文压缩端点,适用于 Codex CLI 长会话
POST
使用 Codex 上下文压缩接口压缩长会话上下文,降低后续请求的上下文体积。该端点主要供 Codex CLI 或兼容 Responses API 的客户端使用。
接口说明
该接口用于把较长的 Codex 会话内容压缩成更短的延续上下文。Base URL 只填写https://gogogotoken.ai,实际请求路径为 /v1/responses/compact。
普通 Codex 对话请使用
POST /v1/responses。只有需要压缩上下文时才调用该端点。请求头
string
required
API Key 鉴权信息,格式为
Bearer YOUR_API_KEY。string
required
固定为
application/json。请求体
string
default:"gpt-5.6-sol"
required
Codex 模型 ID,例如
gpt-5.6-sol。完整列表以 GET /v1/models 与分组配置为准。string
required
需要压缩的上下文内容。可传字符串,也可传 Responses API 兼容的结构化输入。
string
可选的缓存键。网关可基于该字段保持同一会话上游路由稳定。
响应体
string
本次压缩响应 ID。
string
响应状态,例如
completed、failed。object[]
压缩后的上下文内容。文本结果通常位于
output[].content[].text。object
token 用量统计。
