Skip to main content
在 POST /v1/responses 上设 stream: true,回复将以标准 OpenAI Responses response.* SSE 事件到达:每帧都是 event: <type> + data: <json>,并带单调递增的 sequence_number。官方 SDK 的流式循环可原样消费。

事件表

item 严格一次一个地流出:先 reasoning(当档位产出时),然后 message,最后是任何 function_call 交接;output_index 按 item 递增,且与 response.completed 里最终 output 数组的索引一致。

服务端工具旁路通道

内置服务端工具(数据检索、文献等)不是 output item,官方 SDK 会错误解析未知 item 类型,因此其轨迹走一个标准流式循环会安全忽略的专用事件:
它在工具被调用时触发;不会开启 output item,也不推进 output_index。想做活动信息流(「正在检索你的记录…」)就渲染它;跳过它也不影响任何功能。 response.mirobody_tool_result 是它的另一半,在该工具的结果落地时推送,同属旁路通道、同样可安全忽略:
用 id / call_id 把结果匹配到它的调用。流式的 result 截断到 4096 字符(被截断时 truncated: true);完整值始终在最终响应对象(response.completed)的 tool_steps[].result 上。

失败事件

上游出错时,流以 response.failed 结束(而非断管):
Answers API 更简单的 chat.completion.chunk 流式见 Answers API → 流式传输。

另见