Appearance
Chat Completions
清霄 API 文本对话接口,兼容 OpenAI Chat Completions。可用 model id 以控制台为准。
| 项 | 值 |
|---|---|
| Path | POST /v1/chat/completions |
| Base | https://api.qingxiaocloud.com |
| Auth | Authorization: Bearer sk-… |
| Content-Type | application/json |
请求示例
bash
curl -sS "https://api.qingxiaocloud.com/v1/chat/completions" \
-H "Authorization: Bearer sk-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [
{"role": "system", "content": "你是简洁的助手。"},
{"role": "user", "content": "你好"}
],
"stream": false
}'请求字段
| 字段 | 必填 | 说明 |
|---|---|---|
model | * | 模型 ID(控制台) |
messages | * | 对话消息列表(如 role / content) |
temperature | 默认 1;范围 0–2 | |
top_p | 默认 1;范围 0–1 | |
n | 默认 1;≥1 | |
stream | 默认 false | |
stream_options | object | |
stop | string | array | |
max_tokens | 最大生成 Token | |
max_completion_tokens | 最大补全 Token | |
presence_penalty | 默认 0;-2–2 | |
frequency_penalty | 默认 0;-2–2 | |
logit_bias | object | |
tool_choice | string | object | |
response_format | object | |
reasoning_effort | "low" | "medium" | "high" | |
modalities | array |
响应字段(200)
| 字段 | 说明 |
|---|---|
id / object / created / model | object 例:chat.completion |
choices[] | index;message(role / content / name / tool_calls / tool_call_id / reasoning_content);finish_reason |
usage | prompt_tokens / completion_tokens / total_tokens;prompt_tokens_details;completion_tokens_details(含 reasoning_tokens) |
system_fingerprint | string |
响应示例
json
{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "string",
"reasoning_content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"completion_tokens_details": {
"reasoning_tokens": 0
}
}
}错误体:error.message / type / param / code(常见 400 / 429)。
列出模型
bash
curl -sS "https://api.qingxiaocloud.com/v1/models" \
-H "Authorization: Bearer sk-YOUR_KEY"模型目录与价格以控制台为准;文档不维护货架页。