Invoke functions Only supports Claude series models, available by default in the group
Request
Header Params
Body Params application/json
Example
{"model":"claude-3-5-sonnet-20241022","messages":[{"role":"user","content":"What's the weather like in Beijing today?"}],"tools":[{"name":"get_weather","description":"Get the current weather for a specified location","input_schema":{"type":"object","properties":{"location":{"type":"string","description":"City name, e.g.: Beijing"}},"required":["location"]}}]}
Request Code Samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl--location'/v1/messages' \
--header'anthropic-version: 2023-06-01' \
--header'Authorization: {{Authorization}}' \
--header'Content-Type: application/json' \
--data'{
"model": "claude-3-5-sonnet-20241022",
"messages": [
{
"role": "user",
"content": "What'\''s the weather like in Beijing today?"
}
],
"tools": [
{
"name": "get_weather",
"description": "Get the current weather for a specified location",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name, e.g.: Beijing"
}
},
"required": [
"location"
]
}
}
]
}'
Responses
🟢200成功
application/json
Bodyapplication/json
Example
{"content":[{"text":"Let me help you check the weather in Beijing.","type":"text"},{"id":"toolu_012f3meaYuYj9yPPuyuRVw9U","input":{"location":"Beijing"},"name":"get_weather","type":"tool_use"}],"id":"msg_0195XjbG2FGZfN7Dqkd9kyyW","model":"claude-sonnet-4-20250514","role":"assistant","stop_reason":"tool_use","stop_sequence":null,"type":"message","usage":{"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"input_tokens":478,"output_tokens":71,"service_tier":"standard"}}