previous_response_id 实现对话历史管理Bearer sk-xxxxxxxxxxgpt-5.2、gpt-5、gpt-5-mini 等o1、o3-mini、o4-mini 等gpt-4o、gpt-4.1、gpt-4o-mini 等[{"role": "user", "content": "文本"}](类似 Chat Completions)[{"type": "input_text", "text": "文本"}]input_image、input_file 类型effort:推理力度,可选 "none"、"low"、"medium"、"high"summary:推理摘要,可选 "auto"、"none"、"detailed"{"type": "web_search_preview", "search_context_size": "medium"}{"type": "file_search"}"auto":由模型自动决定是否调用工具"none":禁用工具调用{"type": "function", "function": {"name": "函数名"}}:强制调用指定函数"auto" 或 "disabled"| 事件类型 | 说明 |
|---|---|
response.created | 响应创建 |
response.in_progress | 响应进行中 |
response.output_item.added | 输出项添加(工具调用开始) |
response.output_text.delta | 文本增量 |
response.output_text.done | 文本完成 |
response.output_item.done | 输出项完成 |
response.completed | 响应完成 |
search_context_size:搜索上下文大小
"low":低上下文,更快但结果较少"medium":中等上下文(默认)"high":高上下文,更多搜索结果但更慢user_location(可选):用户位置信息
country:国家代码(如 “US”、“CN”)region:州/省份city:城市timezone:时区effort:推理力度
"none":不进行推理"low":轻量推理"medium":中等推理(默认)"high":深度推理summary:推理摘要
"none":不输出推理摘要"auto":自动决定是否输出摘要"detailed":输出详细推理过程previous_response_id 延续之前的对话。
| 特性 | Responses API | Chat Completions API |
|---|---|---|
| 推理模型支持 | ✅ 完整支持 | ⚠️ 有限支持 |
| 内置 Web Search | ✅ 原生支持 | ❌ 不支持 |
| 推理控制 | ✅ 精细控制 | ❌ 不支持 |
| 对话延续 | ✅ previous_response_id | ✅ 通过 messages |
| 流式输出 | ✅ SSE 格式 | ✅ SSE 格式 |
| 客户端兼容性 | ⚠️ 需要适配 | ✅ 标准格式 |
| 适用场景 | 推理、搜索、高级功能 | 通用对话 |