返回接口概览
POST/v1/chat/completions

创建对话补全

使用 OpenAI Chat Completions 格式生成回复。

API Key JSON

请求

curl -X POST https://top.qingyuntop.ai/v1/chat/completions \
  -H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{  "model": "your-model-id",  "messages": [    {      "role": "user",      "content": "你好"    }  ],  "stream": false}'

请求参数

参数位置类型必填说明
modelbodystring从 GET /v1/models 返回的模型 ID。
messagesbodyarray按时间顺序排列的对话消息。
streambodyboolean为 true 时使用 SSE 流式返回。
temperaturebodynumber模型支持时控制输出随机性。

响应示例

{
  "id": "chatcmpl_example",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "你好,有什么可以帮你?"
      },
      "finish_reason": "stop"
    }
  ]
}