OpenAI shape
tool_choice takes none, auto, required, or a named function
({"type": "function", "function": {"name": "get_weather"}}).
Anthropic shape
On/v1/messages, tools are flat and the schema key is input_schema:
tool_choice takes auto, any, none, or {"type": "tool", "name": "…"}. Anthropic’s
server-side built-in tools are rejected by name — they would need us to run something on
your behalf, which this API does not do.
Not every model can do this
Tool calling is a property of the model, not of the API. If no provider that can serve your chosen model supports tools, the call is rejected:GET /v1/models for what an account can call; capability
detail lives in the console.
Reading the call back
The model’s turn comes back withfinish_reason: "tool_calls" and the arguments as a JSON
string, not an object — parse it, and be ready for it to be malformed, because a model
produced it:
role: "tool" turn carrying your result, and call
again. The conversation is yours to keep — this API stores nothing between calls.
Next
Structured outputs
When you want JSON back rather than a function call.
Chat completions
Every parameter, including the two above.