Skip to content

Anthropic Messages ​

清霄 API 的 Anthropic Claude Messages 兼容路径。

项值
PathPOST /v1/messages
Basehttps://api.qingxiaocloud.com
AuthAuthorization: Bearer sk-…;或头 x-api-key
必填头anthropic-version(例:2023-06-01)
Content-Typeapplication/json

可用 model 以控制台 / 实际接口为准。

请求示例 ​

bash
curl -sS "https://api.qingxiaocloud.com/v1/messages" \
  -H "x-api-key: sk-YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_MODEL_ID",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Hello"}
    ]
  }'

亦可使用 Authorization: Bearer sk-YOUR_KEY 代替 x-api-key。

请求字段 ​

字段必填说明
model*
messages*
max_tokens*≥1
systemstring | array
temperature0–1
top_p
top_k
streamboolean
stop_sequencesarray
tools
tool_choice
thinkingobject
metadataobject

响应字段(200) ​

字段说明
id / type / role / modeltype 例:message;role 例:assistant
content[]type / text
stop_reason例:end_turn
usageinput_tokens / output_tokens / cache_creation_input_tokens / cache_read_input_tokens

响应示例 ​

json
{
  "id": "string",
  "type": "message",
  "role": "assistant",
  "content": [{ "type": "text", "text": "string" }],
  "model": "string",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0
  }
}

清霄 · 专业 LLM 聚合平台