How it works
Define tools
Describe your functions with a JSON Schema for their parameters and pass them in
tools.Model requests a call
If the model decides a tool is needed, the response contains
tool_calls with the function name and JSON arguments, and finish_reason is tool_calls.Example
Controlling tool use
Usetool_choice to steer the model:
| Value | Behavior |
|---|---|
"auto" | The model decides whether to call a tool. Default when tools are present. |
"none" | The model never calls a tool and replies with text. |
"required" | The model must call at least one tool. |
{ "type": "function", "function": { "name": "..." } } | Force a specific tool. |
parallel_tool_calls to false if you want at most one tool call per turn.
Tool calling is supported on models that list
tools in their
supported_features. Check the models catalog. For
example, Deepshi 3.0 and the frontier models support tools (Deepshi 2.0 does not).