Skip to main content

Comparison

OpenAI vs Anthropic Function Calling Comparison: The Round Trip, Who Runs the Tool, and the Bill

By AInews Desk
OpenAI vs Anthropic Function Calling Comparison: The Round Trip, Who Runs the Tool, and the Bill
7 min read
1236 words

OpenAI and Anthropic both let a model call functions you define, and both bill the definitions as input tokens. Anthropic routes tool use through its own request-and-response cycle, which uses stop reasons and typed content blocks. This piece covers how each round trip works, who runs the tool, how to control when the model calls one, and what tools add to the bill.

Five numbered steps on one side, a stop reason on the other

OpenAI's guide breaks the flow into five steps:

  1. Send a request with the tools the model could call.
  2. Receive a tool call.
  3. Run code in your application using the call's input.
  4. Send a second request with the tool output.
  5. Receive a final response, or more tool calls.

In the Responses API, your application can keep this loop going for as many tool calls as the task needs. There's one catch that's easy to miss. With reasoning models like GPT-5 or o4-mini, you must pass back any reasoning items returned alongside tool calls together with the tool outputs.

Anthropic's version has the same shape but different signals. For a client tool, Claude responds with stop_reason: "tool_use" and one or more tool_use blocks, and your code runs the operation and sends back a tool_result. To have Claude call your own function, you pass a tool with an input_schema and act when the tool_use block arrives. In practice, OpenAI hands you a numbered procedure. Anthropic hands you a stop reason to branch on.

Who actually runs the code?

The two vendors differ most on where execution happens. Anthropic says tools differ primarily by where the code runs:

  • Client tools run in your application. These include tools you define and tools with Anthropic-defined schemas, such as bash and text_editor.
  • Server tools, such as web_search, web_fetch, code_execution and tool_search, run on Anthropic's infrastructure. You see the results directly without handling execution, unless Claude calls the tool in the same group of parallel tool calls as one of your client tools.

OpenAI organizes its guide around the format of a tool's input and output. It covers function tools (defined by a JSON schema) and custom tools that work with free-form text inputs and outputs. OpenAI also offers built-in tools that let the model search the web, run code and connect to an MCP server. Mixing built-in tools with your functions has a limit. Starting with GPT-5, supported models can call functions in parallel when built-in tools are available, but built-in tools cannot be included in a parallel function-call batch.

OpenAI's split between function tools and custom tools matters when your tool takes free-form text rather than structured JSON.

Controlling when the model reaches for a tool

On Anthropic, with the default tool_choice of {"type": "auto"}, Claude determines on each turn whether to call a tool or respond directly. Anthropic suggests a step you might not try first: changing your system prompt. If Claude isn't calling tools when you expect, a light instruction such as "Use the tools to investigate before responding." increases tool use. "Always call a tool first before responding." pushes further. "Use your judgment about whether to call a tool or respond directly." keeps Claude cautious about calling tools. To require a tool call rather than rely on prompting, set tool_choice (platform.claude.com). Anthropic's own example sets disable_parallel_tool_use: true inside tool_choice, and adding strict: true to your custom tool definitions ensures Claude's tool calls always match your schema exactly.

OpenAI's documented controls are parameters. Setting parallel_tool_calls to false ensures exactly zero or one tool is called in a turn. Fine-tuned models have a known problem here: if a fine-tuned model calls multiple functions in one turn, strict mode is disabled for those calls. If you rely on strict mode on a fine-tuned model, turn parallel calls off. Our structured-outputs piece covers the schema rules strict mode enforces, so they aren't repeated here.

OpenAI's guide lists the tool_choice settings: auto (the default: zero, one or multiple calls), required (one or more calls), a forced function (exactly one specific function), allowed tools (a subset of the tools you passed), and none, which imitates passing no functions. OpenAI also says: "We recommend always enabling strict mode."

What tools add to the bill

Neither vendor makes tool definitions free. On OpenAI, functions are injected into the system message, so they count against the model's context limit and are billed as input tokens. To cut that cost, OpenAI suggests limiting the number of functions loaded up front, shortening descriptions, or using tool search so deferred tools load only when needed. Tool search only works on recent models: gpt-5.4 and later support tool_search. Fine-tuning can also reduce token use if you have a large set of functions.

Anthropic itemizes the cost. Tool use is priced on input tokens (including the tools parameter), output tokens, and, for server-side tools, extra usage-based charges such as a fee for each web search. Client-side tools cost the same as any other Claude API request. The extra tokens come from the tools parameter, tool_use blocks and tool_result blocks. When you use tools, the API also automatically adds a special system prompt, and its token count varies by model: the table lists 286 tokens with tool_choice auto or none on Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5. If you pass no tools and set tool_choice to none, that prompt adds no tokens. Responses report input and output token counts in the usage metrics, so you can check your actual spend after each call.

DimensionOpenAIAnthropic
Round-trip signalTool call in response, then a 2nd requeststop_reason: "tool_use"
Result formatTool output in the follow-up requesttool_result block
Tool typesJSON-schema functions, free-text custom toolsClient tools, server tools
Vendor-run toolsBuilt-in (web, code, MCP)web_search, web_fetch, code_execution, tool_search
Limiting parallel callsparallel_tool_calls: falsedisable_parallel_tool_use in tool_choice
Steeringtool_choice (auto, required, forced, allowed tools, none)System prompt, tool_choice
Definition costBilled as input tokensBilled as input tokens
Extra chargesNot stated in the guideServer tool usage, tool system prompt
Large-toolset fixTool search (gpt-5.4+)Tool search tool (server tool)

Choosing by workload

Neither API is better across the board. The right choice depends on your workload.

  • Your tools are mostly internal business logic. Both round trips work much the same way. Decide based on which control style you prefer: OpenAI's explicit parameters or Anthropic's prompt-level steering backed by tool_choice.
  • You want web search or code execution without hosting them. Both vendors run these for you: OpenAI's built-in tools and Anthropic's server tools. Anthropic says its server tools add usage-based charges, so budget for those per call.
  • You have a large tool catalog. Both offer tool search, so you don't send every definition on every request: OpenAI's tool_search on gpt-5.4 and later, and Anthropic's tool search tool, which loads tools on demand.
  • You're watching the bill closely. On both platforms, every definition you send costs input tokens. Send fewer tools, keep descriptions short, and read the usage numbers before you scale up.

Sources

7 min read
•
1236 words

Tags

OpenAI vs Anthropic function calling comparisonOpenAI function calling vs Anthropic toolstool use implementation differencesfunction calling pricing cost comparison

Related Articles