{
"model": "claude-sonnet-4-5-20250929",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "查一下加利福尼亚·洛杉矶今天的天气?"
}
],
"tools": [
{
"description": "Get the current weather in a given location",
"input_schema": {
"properties": {
"location": {
"description": "The city and state, e.g. San Francisco, CA",
"type": "string"
},
"unit": {
"description": "Unit for the output - one of (celsius, fahrenheit)",
"type": "string"
}
},
"required": [
"location"
],
"type": "object"
},
"name": "get_weather"
}
]
}curl --location -g --request POST 'http://api.example.com/v1/messages' \
--header 'x-api-key: sk-xxx' \
--header 'anthropic-version: 2023-06-01' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "claude-sonnet-4-5-20250929",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "查一下加利福尼亚·洛杉矶今天的天气?"
}
],
"tools": [
{
"description": "Get the current weather in a given location",
"input_schema": {
"properties": {
"location": {
"description": "The city and state, e.g. San Francisco, CA",
"type": "string"
},
"unit": {
"description": "Unit for the output - one of (celsius, fahrenheit)",
"type": "string"
}
},
"required": [
"location"
],
"type": "object"
},
"name": "get_weather"
}
]
}'{
"model": "claude-sonnet-4-5-20250929",
"id": "msg_01ALK6rR3mc9VMdH95WprsKw",
"type": "message",
"role": "assistant",
"content": [
{
"type": "tool_use",
"id": "toolu_01J7Hw4CBk4voUT8TUNp8MGd",
"name": "get_weather",
"input": {
"location": "Los Angeles, CA"
}
}
],
"stop_reason": "tool_use",
"stop_sequence": null,
"usage": {
"input_tokens": 628,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation": {
"ephemeral_5m_input_tokens": 0,
"ephemeral_1h_input_tokens": 0
},
"output_tokens": 56,
"service_tier": "standard"
}
}