Skip to content

Chat Completions ​

清霄 API 文本对话接口,兼容 OpenAI Chat Completions。可用 model id 以控制台为准。

项值
PathPOST /v1/chat/completions
Basehttps://api.qingxiaocloud.com
AuthAuthorization: Bearer sk-…
Content-Typeapplication/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_optionsobject
stopstring | array
max_tokens最大生成 Token
max_completion_tokens最大补全 Token
presence_penalty默认 0;-2–2
frequency_penalty默认 0;-2–2
logit_biasobject
tool_choicestring | object
response_formatobject
reasoning_effort"low" | "medium" | "high"
modalitiesarray

响应字段(200) ​

字段说明
id / object / created / modelobject 例:chat.completion
choices[]index;message(role / content / name / tool_calls / tool_call_id / reasoning_content);finish_reason
usageprompt_tokens / completion_tokens / total_tokens;prompt_tokens_details;completion_tokens_details(含 reasoning_tokens)
system_fingerprintstring

响应示例 ​

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"

模型目录与价格以控制台为准;文档不维护货架页。

清霄 · 专业 LLM 聚合平台