curl --location --request POST 'https://api.302.ai/v1/messages' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "claude-sonnet-4-5-20250929",
"max_tokens": 1024,
"tools": [
{
"name": "get_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": [
"location"
]
}
}
],
"tool_choice": {
"type": "auto"
},
"messages": [
{
"role": "user",
"content": "What is the weather like in San Francisco?"
}
]
}'{
"model": "claude-sonnet-4-5-20250929",
"id": "msg_bdrk_018PChWZnZJ2SosBfSG3Son9",
"type": "message",
"role": "assistant",
"content": [
{
"type": "tool_use",
"id": "toolu_bdrk_01NbTnANdrviLjJQy5wzEEmX",
"name": "get_weather",
"input": {
"location": "San Francisco, CA"
}
}
],
"stop_reason": "tool_use",
"stop_sequence": null,
"usage": {
"input_tokens": 586,
"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
}
}