POST /v1/chat/completions
Tools are declared with a nested function object. The model returns tool_calls inside the assistant message.
Define a tool
Full loop
Streaming
Tool-call arguments arrive across multiple chunks. Accumulatedelta.tool_calls[i].function.arguments strings until finish_reason: "tool_calls". See streaming.
Forcing a tool
"none" disables tools. "auto" is the default when you provide a non-empty
tools array.
When no tools are available, omit both tools and tool_choice. Chat
Completions rejects an empty tools array and rejects "auto", "required",
or a named tool choice when tools is omitted.
Parallel tool calls
The model can return multipletool_calls in one response. Execute them in parallel and append each result with a matching tool_call_id. Set parallel_tool_calls=False to return at most one tool call. This setting does not allow tool_choice without tools.