stream 未设置或为 false 时,接口返回一个 chat.completion 对象。当 stream: true 时,接口返回一系列 chat.completion.chunk SSE 事件。
非流式响应对象
choices[]
choices[].message
tool_calls[]
choices[].logprobs
每个 token 项包含:
usage
prompt_tokens_details 可包含 cached_tokens、cache_write_tokens、audio_tokens、image_tokens 与 text_tokens。
completion_tokens_details 可包含以下字段:
reasoning_tokensaudio_tokenstext_tokensaccepted_prediction_tokensrejected_prediction_tokens
响应示例
流式事件对象
每个 SSE 数据行都是一个chat.completion.chunk 对象:
choices[].delta
delta 只包含相对于前一事件新增的字段。
流会以
data: [DONE] 结束。结束前的最后一个业务事件通常在 choices[].finish_reason 中提供 stop、length 或 tool_calls。