Features
Tool Calling
Connect models to external systems with the standard tools, tool_choice, and tool_calls structures.
Function calling lets a model express a structured intent to call a tool. Your application executes the tool, so it can enforce permissions, confirmation, auditing, and idempotency before execution.
Standard request body
{
"model": "qwen-turbo",
"messages": [
{
"role": "user",
"content": "What is the weather in Shanghai now?"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "City name"
}
},
"required": ["city"],
"additionalProperties": false
}
}
}
],
"tool_choice": "auto"
}Model-generated call
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_weather_01",
"type": "function",
"function": {
"name": "get_current_weather",
"arguments": "{\"city\":\"Shanghai\"}"
}
}
]
}Tool result message
{
"role": "tool",
"tool_call_id": "call_weather_01",
"content": "{\"city\":\"Shanghai\",\"temperature\":25,\"condition\":\"cloudy\"}"
}API versions
Legacy functions structure
functionsfunction_call- Still common in older tutorials.
Current tools structure
toolstool_choicemessage.tool_calls
For a complete application execution loop and result submission example, see Tool Calling Guide.