众扬汇 AI 开放平台 API 文档

聊天完成对象

非流式调用 /chat/completions 时,返回体即一个 chat.completion 对象。

字段一览:

  • id(string):本次对话完成的唯一标识;
  • choices(array):候选回复列表,n 大于 1 时包含多项;
  • created(integer):生成时间的 Unix 时间戳(秒);
  • model(string):实际完成本次请求的模型;
  • system_fingerprint(string):后端配置指纹,便于比对版本差异;
  • object(string):固定取值 chat.completion;
  • usage(object):本次请求的用量统计,其下含 completion_tokens(输出侧 token 数)、prompt_tokens(输入侧 token 数)、total_tokens(两者合计)。

响应示例:

JSON
{
  "object": "chat.completion",
  "id": "chatcmpl-9f2c1a",
  "created": 1730000000,
  "model": "<模型名>",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "你好,需要我做什么?" },
      "finish_reason": "stop"
    }
  ],
  "system_fingerprint": "fp_9c31b",
  "usage": { "prompt_tokens": 11, "completion_tokens": 8, "total_tokens": 19 }
}