← Blog

Claude API Function Calling vs OpenAI: Key Differences

2026-09-28 · 5 min read · SubToAPI Team

Both Claude and OpenAI let a model call external functions to fetch data, run code, or trigger actions in your app instead of just generating text. The mechanics are similar at a high level — you describe available tools in JSON Schema, the model decides when to call one, and you return the result so the model can continue — but the request/response shapes, streaming behavior, and a few edge cases differ enough that porting code between the two isn't a copy-paste job.

If you're choosing between the two for a new integration, the short answer is: OpenAI's function calling API is slightly more mature in tooling (structured outputs, strict mode), while Claude's tool use is generally considered stronger at multi-step reasoning about when and how to call tools, especially in agentic workflows with several tools available at once. Below is a breakdown of the concrete differences that matter when you're writing code.

Request format differences

OpenAI wraps tool definitions under tools, each with a type: "function" and a function object containing name, description, and parameters. Claude uses a flatter structure: each tool has name, description, and input_schema directly, with no type wrapper.

OpenAI:

{
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather for a city",
        "parameters": {
          "type": "object",
          "properties": { "city": { "type": "string" } },
          "required": ["city"]
        }
      }
    }
  ]
}

Claude:

{
  "tools": [
    {
      "name": "get_weather",
      "description": "Get current weather for a city",
      "input_schema": {
        "type": "object",
        "properties": { "city": { "type": "string" } },
        "required": ["city"]
      }
    }
  ]
}

Functionally equivalent, but if you have a shared "tools" definition library across providers, you'll need a thin adapter layer to convert between the two shapes.

How tool calls come back

OpenAI returns tool calls in message.tool_calls, an array of objects each with an id, type, and a function object containing name and a stringified JSON arguments field — you have to JSON.parse() it yourself.

Claude returns tool calls as content blocks inside the message, with type: "tool_use", an id, name, and input that's already a parsed JSON object — no manual parsing step. This is a small but real convenience if you're building the loop by hand.

{
  "content": [
    { "type": "text", "text": "Let me check that." },
    {
      "type": "tool_use",
      "id": "toolu_01A",
      "name": "get_weather",
      "input": { "city": "Berlin" }
    }
  ]
}

To send the result back, Claude expects a tool_result block referencing the tool_use_id inside a user message, whereas OpenAI expects a tool role message referencing tool_call_id. Both patterns require you to append the assistant's tool-call message to the conversation before sending the result back — skipping that step is the most common bug in both integrations.

Forcing or restricting tool use

Both APIs let you control whether the model must call a tool, is free to choose, or is blocked from calling any tool.

The naming differs ("required" vs "any") but the capability is the same. One difference worth knowing: Claude's disable_parallel_tool_use flag lets you explicitly turn off parallel calls when you need the model to call tools strictly one at a time — useful for workflows where tool B depends on tool A's result and you don't want the model batching them speculatively.

Parallel tool calls

Both providers support the model requesting multiple tool calls in a single response when the tasks are independent (e.g., "get the weather in three cities"). In practice, Claude tends to be more conservative about parallelizing when there's any dependency between calls, which reduces cases where you get a tool call with an argument that depended on a result you haven't returned yet. If your workflow has strict sequencing requirements, this behavioral difference is worth testing against your specific tool set rather than assuming based on documentation alone.

Streaming with tool use

Streaming tool calls is where the two diverge most. OpenAI streams tool_calls deltas where the arguments string arrives in fragments you must concatenate before parsing. Claude streams input_json_delta events for tool_use blocks with partial JSON that follows the same accumulate-then-parse pattern, but the block/event structure (content_block_start, content_block_delta, content_block_stop) is more explicit about block boundaries, which makes it easier to know exactly when a given tool call's arguments are complete.

If you're building this yourself, budget real time for edge cases: partial JSON parsing, multiple tools streaming in parallel, and text blocks interleaved with tool_use blocks in the same response. This is exactly the kind of plumbing that eats a sprint when you just wanted to ship a feature — see /docs/streaming and /docs/tools for the details on handling it against SubToAPI's endpoint if you want to skip writing that parser from scratch.

Structured outputs and schema strictness

OpenAI's "strict mode" for function calling guarantees the returned arguments match your JSON Schema exactly, including handling of enums and required fields, and is a genuinely useful feature for production pipelines where malformed arguments break downstream code. Claude does not have an equivalent strict flag — it follows the schema well in practice but doesn't offer a hard guarantee. If your workflow depends on 100% schema-valid arguments every time, add server-side validation regardless of which provider you use; don't rely on either "guarantee" as your only safety net.

Picking one (or both)

For most product teams, the deciding factor isn't the API shape — it's model behavior on your actual tools: does it call the right tool at the right time, does it ask clarifying questions when arguments are ambiguous, does it avoid hallucinating tool names. Test with your real tool definitions and real prompts rather than trusting benchmarks.

If you're already using Claude and want an OpenAI-style REST surface with API keys, streaming and usage tracking without building the plumbing yourself, SubToAPI turns your Claude access into an HTTPS API with sub_live_... keys, tool use support, and per-key usage metadata. Check /docs/tools for the tool use reference or /pricing for plan details, and /signup includes a free trial to test it against your own tool schemas.

questions

Does Claude API function calling support parallel tool calls like OpenAI? Yes. Both APIs can return multiple tool calls in a single response when the tasks are independent. Claude also lets you disable this behavior with disable_parallel_tool_use when you need strictly sequential calls.

Is Claude's tool use format compatible with OpenAI's function calling format? No, they use different JSON shapes (input_schema vs parameters, tool_use blocks vs tool_calls arrays), so you need an adapter layer if you support both providers in the same codebase.

Which is better for building AI agents, Claude or OpenAI function calling? Both are capable; Claude is often preferred for multi-step agentic reasoning with several tools, while OpenAI's strict mode is preferred when you need guaranteed schema-valid arguments. Test against your actual tools before deciding.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →