Appearance
Anthropic Messages
清霄 API 的 Anthropic Claude Messages 兼容路径。
| 项 | 值 |
|---|---|
| Path | POST /v1/messages |
| Base | https://api.qingxiaocloud.com |
| Auth | Authorization: Bearer sk-…;或头 x-api-key |
| 必填头 | anthropic-version(例:2023-06-01) |
| Content-Type | application/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 |
system | string | array | |
temperature | 0–1 | |
top_p | ||
top_k | ||
stream | boolean | |
stop_sequences | array | |
tools | ||
tool_choice | ||
thinking | object | |
metadata | object |
响应字段(200)
| 字段 | 说明 |
|---|---|
id / type / role / model | type 例:message;role 例:assistant |
content[] | type / text |
stop_reason | 例:end_turn |
usage | input_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
}
}