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}'请求参数
| 参数 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
model | body | string | 是 | 从 GET /v1/models 返回的模型 ID。 |
messages | body | array | 是 | 按时间顺序排列的对话消息。 |
stream | body | boolean | 否 | 为 true 时使用 SSE 流式返回。 |
temperature | body | number | 否 | 模型支持时控制输出随机性。 |
响应示例
{
"id": "chatcmpl_example",
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "你好,有什么可以帮你?"
},
"finish_reason": "stop"
}
]
}