Claude API Tool Use vs OpenAI Functions: Compared
If you're building an app that calls external functions — database lookups, calculators, API wrappers — you'll eventually need to pick between Claude's tool use and OpenAI's function calling. Both let a model decide when to invoke a function and return structured arguments instead of free text. The mechanics differ enough that porting code between the two isn't a copy-paste job.
The short answer: Claude uses a tools array with JSON Schema input_schema objects and returns tool_use content blocks inside the normal message response; OpenAI uses a tools array with parameters (also JSON Schema) and returns a tool_calls array on the assistant message. The concepts are nearly identical — define a schema, let the model emit matching arguments, run your code, send the result back — but the field names, response shapes, and multi-turn conventions are different, and that's where most migration bugs come from.
How tool definitions compare
Both APIs want a name, a description, and a JSON Schema for parameters. The structure is almost the same, just nested differently.
OpenAI:
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": { "type": "string" }
},
"required": ["city"]
}
}
}
Claude:
{
"name": "get_weather",
"description": "Get current weather for a city",
"input_schema": {
"type": "object",
"properties": {
"city": { "type": "string" }
},
"required": ["city"]
}
}
OpenAI wraps everything under function; Claude keeps tool definitions flat and calls the schema field input_schema instead of parameters. If you're generating tool definitions programmatically from the same source (say, Zod or Pydantic schemas), you need a thin adapter layer that renames fields for whichever API you're targeting.
How the model's response differs
This is the bigger practical difference.
OpenAI returns a tool_calls array on the assistant message, each with an id, a function.name, and a function.arguments string that you need to JSON.parse yourself.
Claude returns a content array that can mix text and tool_use blocks in the same response. Each tool_use block already has parsed input as a JSON object — no manual parsing step — plus an id you use to match the result back.
{
"role": "assistant",
"content": [
{ "type": "text", "text": "Let me check that." },
{
"type": "tool_use",
"id": "toolu_01A",
"name": "get_weather",
"input": { "city": "Lisbon" }
}
]
}
To continue the conversation, Claude expects a tool_result content block in the next user message, referencing that same id:
{
"role": "user",
"content": [
{
"type": "tool_result",
"tool_use_id": "toolu_01A",
"content": "18°C, partly cloudy"
}
]
}
OpenAI's equivalent is a separate message with role: "tool", tool_call_id, and content as a string. Functionally equivalent, structurally distinct — and if you're building provider-agnostic middleware, this is the part that requires actual translation logic, not just renamed keys.
Stop reasons and detecting tool calls
Claude signals that it wants to call a tool via stop_reason: "tool_use" on the top-level response. OpenAI signals it via finish_reason: "tool_calls". Both are reliable ways to branch your code: if the stop/finish reason matches, extract the call(s), execute them, and send results back in a follow-up request. Neither API executes your function for you — you're always the one running the code and returning the result.
Multiple tools in one turn
Both APIs support the model requesting more than one tool call in a single response — useful when two independent lookups don't depend on each other's output. Claude puts multiple tool_use blocks in the same content array; OpenAI puts multiple entries in the tool_calls array. The execution pattern is the same either way: loop over the calls, run each function, collect the results, and send them all back together before the model continues.
Forcing or disabling tool use
Both let you control whether the model must use a tool. Claude exposes a tool_choice parameter with auto, any (must use one of the tools), or tool (force a specific one). OpenAI's tool_choice supports auto, none, required, and forcing a specific function by name. The intent is the same; again, the keywords don't match 1:1, so hardcoded strings don't transfer.
If you're already paying for Claude
If your team already has Claude access and you want tool use exposed as a clean HTTPS endpoint — with an application API key, usage metadata, and team seats instead of sharing a personal login — SubToAPI wraps this for you. You get a standard sub_live_... key, the same tool-use request/response shape described above, and streaming support, without building your own proxy layer. See /docs/tools for the exact request format, or /docs/quickstart to get a key working in a few minutes. Plans start at €9/month on the Solo tier, with Team and Scale tiers for shared seats — details on /pricing.
Which should you pick?
If you're choosing between the two providers specifically for tool use, the decision usually comes down to model behavior and quality on your task, not the API shape — both are capable and well-documented. The practical advice: write an internal abstraction layer with your own tool-call format, and translate to/from Claude's or OpenAI's conventions at the edges. That way switching providers, or running both for comparison, doesn't mean rewriting your business logic.
questions
Can I use the same JSON Schema for both Claude and OpenAI tools? Yes, the schema itself (types, properties, required fields) is standard JSON Schema and works unchanged. Only the wrapping field name differs — input_schema for Claude, parameters nested under function for OpenAI.
Does Claude parse tool arguments for me, or do I get a raw string? Claude returns input as an already-parsed JSON object inside each tool_use block. OpenAI returns arguments as a string that you must JSON.parse yourself.
Can both APIs call multiple tools in a single turn? Yes. Claude includes multiple tool_use blocks in one content array; OpenAI includes multiple entries in tool_calls. You execute each independently and return all results before the next model turn.