Skip to content

返回结果说明

非流式 Chat Completions 成功后,常见结构如下:

json
{
  "id": "chatcmpl-...",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "你好!"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 6,
    "total_tokens": 16
  }
}

重点看哪里

  • choices[0].message.content:模型回答;
  • finish_reason:停止原因;
  • usage:输入、输出和总 Token;
  • id:本次响应标识。

流式返回

stream 为 true 时,服务器会分块返回内容。终端里会看到多行 data,而不是一次得到完整 JSON。这不是报错。

错误返回

失败响应通常包含 HTTP 状态码和 message。记录状态码、请求时间、模型 ID 和 Request ID,再按错误排查处理。

撩梦中转站 · Simple API, More Possibilities.