{
"model": "claude-opus-4-7",
"system": "你是一个简洁、准确的中文助手。优先直接回答,不要赘述。",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "你好"
}
]
}
],
"max_tokens": 256,
"stop_sequences": [
"<END>",
"【结束】"
],
"temperature": 0.7,
"top_p": 0.9,
"top_k": 40,
"stream": false,
"metadata": {
"user_id": "rich-curl-test-user"
},
"tools": [
{
"name": "get_weather",
"description": "查询指定城市的天气信息",
"input_schema": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "城市名称"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "温度单位"
}
},
"required": ["city"]
}
}
],
"tool_choice": {
"type": "auto",
"disable_parallel_tool_use": false
}
}curl --location --request POST '/v1/messages' \
--header 'x-api-key: Bearer sk-你的令牌' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "claude-opus-4-7",
"system": "你是一个简洁、准确的中文助手。优先直接回答,不要赘述。",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "你好"
}
]
}
],
"max_tokens": 256,
"stop_sequences": [
"<END>",
"【结束】"
],
"temperature": 0.7,
"top_p": 0.9,
"top_k": 40,
"stream": false,
"metadata": {
"user_id": "rich-curl-test-user"
},
"tools": [
{
"name": "get_weather",
"description": "查询指定城市的天气信息",
"input_schema": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "城市名称"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "温度单位"
}
},
"required": ["city"]
}
}
],
"tool_choice": {
"type": "auto",
"disable_parallel_tool_use": false
}
}'{"content":[{"citations":[],"text":"你好!我是 Claude,由 Anthropic 开发。有什么我可以帮助你的吗?","type":"text"}],"id":"msg_20260430152228","model":"claude-opus-4-7","role":"assistant","stop_reason":"end_turn","stop_sequence":null,"type":"message","usage":{"cache_creation_input_tokens":0,"cache_read_input_tokens":10,"input_tokens":17,"output_tokens":49}}