Skip to Content
API 文档ChatChat流式响应

Chat Completion流式响应对象块

AI模型流式生成的Chat Completion响应对象块数据

属性

  • id string
    生成的聊天响应ID
  • object string
    模型生成聊天响应的模式,此模式下总为chat.completion.trunk
  • created timestamp
    聊天响应时的Unix时间戳,单位为秒
  • model string
    模型名称
  • choices object array
    模型流式生成的聊天响应结果的可选路径列表。单个choice object属性:
    展开/收起
    • finish_reason string
      模型停止继续生成的原因
    • index int
      当前可选路径序列号
    • delta object
      模型渐进生成的聊天响应块
    展开/收起
    • role string
      消息所属角色,此处总为assistant
    • content string
      消息文本内容
    • reasoning string
      推理思考过程内容,仅在 step 推理模型下返回。
    • tool_calls object array optional
      toolcall内容返回
    展开/收起
    • id string
      函数执行ID,由模型生成,在context保持唯一。
    • type string
      toolcall的类型,默认为function
    • function object
      函数的消息体
    展开/收起
    • name string
      函数名称,通常纯英文、数字和_-符号,一般是在上一轮对话提交的tools列表中
    • arguments string
      函数执行的参数,一般为json结构化对象。
  • usage object
    模型聊天响应生成的标记统计信息
    展开/收起
    • prompt_tokens int
      生成过程中使用的提示信息总标记数量
    • cached_tokens int optional
      生成过程中使用的提示信息被缓存的总标记数量
    • completion_tokens int
      生成的响应消息内容总标记数量
    • total_tokens int
      生成结束后统计的总的标记数量

示例

data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"您"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":1,"total_tokens":84}} data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"好"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":2,"total_tokens":85}} data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"!"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":3,"total_tokens":86}} data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"阶"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":4,"total_tokens":87}} data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"跃"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":5,"total_tokens":88}} ... data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"更多的"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":147,"total_tokens":230}} data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"价值"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":148,"total_tokens":231}} data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"。"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":149,"total_tokens":232}} data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":""},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":150,"total_tokens":233}} data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":""},"finish_reason":"stop"}],"usage":{"prompt_tokens":83,"completion_tokens":150,"total_tokens":233}} data: [DONE]
Last updated on