OpenAI protocol
tool_choice
| Value | Behavior |
|---|---|
"auto" (default) | The model decides on its own |
"none" | Force no tool call |
"required" | Must call some tool |
{"type": "function", "function": {"name": "x"}} | Call a specific tool |
parallel_tool_calls
Newer models support calling multiple tools in parallel by default;tool_calls in the response is an array — execute each and return them all at once.
To disable parallelism, set parallel_tool_calls: false.
Claude protocol
tool_choice (Claude)
Gemini protocol
Protocol interoperability
When you call Claude / Gemini models via OpenPAI’s OpenAI-compatible endpoint, OpenPAI automatically converts the Anthropic / Google tool-calling structures to OpenAI’stools / tool_calls,
and vice versa. You don’t need to worry about protocol differences — just pick one style.
Best practices
Detailed descriptions
The more specific a tool’s
description, the better the model decides when to call it and what arguments to pass.Strict schema
Use
required and additionalProperties: false to keep the model from passing stray fields.Handle errors gracefully
When a tool fails, return the error as a
tool_result so the model can retry or change strategy.Parallel calls
Execute multiple independent tools in parallel in one call to reduce latency.