messages 只接受 user/assistant 角色;系统提示使用顶层 system。响应 content 是异构有序内容块数组,可能包含 text、thinking、redacted_thinking、tool_use 等。Authorization: Bearer ********************{
"model": "claude-opus-4-7",
"max_tokens": 4096,
"system": "回答简洁,并明确给出结论。",
"thinking": {
"type": "adaptive"
},
"messages": [
{
"role": "user",
"content": "比较两个方案并给出结论"
}
],
"stream": false
}curl --location 'https://api.nicerouter.com/v1/messages' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "claude-opus-4-7",
"max_tokens": 4096,
"system": "回答简洁,并明确给出结论。",
"thinking": {
"type": "adaptive"
},
"messages": [
{
"role": "user",
"content": "比较两个方案并给出结论"
}
],
"stream": false
}'content 为异构有序块数组;最终文本位于 text 块,工具调用位于 tool_use 块。{
"id": "msg_example",
"type": "message",
"role": "assistant",
"model": "claude-opus-4-7",
"content": [
{
"type": "thinking",
"thinking": "比较了两个方案。",
"signature": "signature_example"
},
{
"type": "text",
"text": "建议选择方案 A。"
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 18,
"output_tokens": 52
}
}