1 · Define tools
2 · The model calls
When the model decides to use a tool, the response carries a call instead of (or alongside) text:Chat Completions — finish_reason: tool_calls
Messages — stop_reason: tool_use
3 · Return results
Steering with tool_choice
auto(default) — the model decides whether to call.required/{ "type": "any" }— must call some tool (Chat Completions / Messages respectively).- Named — force one specific tool:
{ "type": "function", "function": { "name": "get_weather" } }or{ "type": "tool", "name": "get_weather" }. none— text only, tools stay visible but uncallable.
Tool calls stream too: argument deltas arrive incrementally on both dialects
(Streaming). For extracting structured data without any real tool,
prefer Structured output.