https://api.bianxie.ai,模型 ID 以实时模型页为准。
请求
max_tokens 为必填字段。系统指令通过顶层 system 字段传递,不要使用 OpenAI 的 system message 格式。加入 "stream": true 可启用 SSE 流式输出。
返回结构
content[] 中 type 为 text 的内容。工具调用会以其他内容块类型返回;流式模式则依次发送 message 与 content block 事件。Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
使用原生 Messages API 调用 Claude 模型
https://api.bianxie.ai,模型 ID 以实时模型页为准。
curl https://api.bianxie.ai/v1/messages \
-H "x-api-key: API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model",
"max_tokens": 1024,
"messages": [{
"role": "user",
"content": "用一段话解释量子纠缠。"
}]
}'
max_tokens 为必填字段。系统指令通过顶层 system 字段传递,不要使用 OpenAI 的 system message 格式。加入 "stream": true 可启用 SSE 流式输出。
{
"id": "msg_example",
"type": "message",
"role": "assistant",
"model": "your-model",
"content": [{"type": "text", "text": "量子纠缠是..."}],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {"input_tokens": 18, "output_tokens": 42}
}
content[] 中 type 为 text 的内容。工具调用会以其他内容块类型返回;流式模式则依次发送 message 与 content block 事件。