Claude and OpenAI each shipped a way to force valid JSON out of a model — here's how they differ
Both labs now offer a strict mode that guarantees schema-valid output instead of hoping the model formats it right. The setup rules are specific, and OpenAI's official guidance still caps how many tools you hand the model at once.
Quick answer
How do Claude and OpenAI recommend getting structured output you don't have to validate and retry?
Both offer a strict mode: Claude's `strict: true` on a tool definition, OpenAI's Structured Outputs with `strict: true` in the response format. OpenAI requires `additionalProperties: false` and every field listed as required, with optional fields made nullable instead of omitted. Both guides also warn that vague function descriptions and too many available tools quietly lower accuracy.
Key takeaways
- Structured Outputs on OpenAI's side and strict tool use on Claude's side both guarantee schema adherence — the older 'JSON mode' style does not, and can still return malformed output.
- OpenAI's strict schema requires `additionalProperties: false` and every field in `required`; there is no such thing as an optional field left out of that list — you make it nullable instead.
- OpenAI's own guidance suggests keeping the number of available functions under 20 at the start of a turn, because each definition counts as input tokens and more choices lower accuracy.
- Claude documents a real reliability gap between models: when a required parameter is missing from the prompt, Opus is more likely to ask; Sonnet is more likely to guess a plausible value instead.
- Both platforms bill tool/function definitions as ordinary input tokens on every call, and Claude publishes the exact per-model token overhead this adds.
Getting an LLM to call a function or return JSON has always worked most of the time, which is a worse problem than never working — the failures show up downstream, in a parser that crashes on the ten-thousandth call, not on the ninety-nine you tested by hand. Both Claude and OpenAI now publish a mode that removes the "most of the time" from that sentence, and the official setup rules for each are specific enough to follow directly rather than guess at.
Strict mode, on both sides
Claude's version: add strict: true to a custom tool definition, and Claude's tool call is guaranteed to match the schema. OpenAI's version, called Structured Outputs, is set through text: { format: { type: "json_schema", strict: true, schema: … } }. OpenAI frames this explicitly as the successor to the older "JSON mode" — JSON mode never guaranteed your schema was actually followed, Structured Outputs does.
Write the function description for a stranger
OpenAI's own advice is to write function names, parameter descriptions, and usage instructions clearly enough that what it calls "the intern test" applies: a new hire could use the function correctly from the documentation alone, with no other context. That includes saying explicitly, in the system prompt, when a function should and should not be called, with examples of edge cases — not just what the function does when it's obviously the right call.
Fewer tools, better accuracy
It's tempting to hand the model every tool you have and let it sort out which one applies. OpenAI's guidance pushes back on this directly: keep the number of available functions under roughly 20 at the start of a turn for higher accuracy, and remember that every function definition counts as input tokens whether or not it gets used that turn. If a set of functions is always called in the same sequence, OpenAI's suggestion is to merge them into one operation rather than making the model chain several calls correctly every time.
Claude's models don't fail the same way
Claude's documentation includes a specific, model-level reliability note that's worth planning around rather than discovering in production: when a required parameter is missing from what the user actually typed, Opus is considerably more likely to notice the gap and ask a clarifying question, while Sonnet is more likely to infer a plausible value on its own — guessing a location, for instance, instead of asking which one. This isn't guaranteed behavior in either direction, but it's the direction each model leans, and it gets worse on ambiguous prompts with a less capable model.
Forcing the call, and running several at once
Both platforms let you skip Claude's or OpenAI's default judgment call about whether to use a tool at all. Claude exposes tool_choice to force a call rather than leaving it on the default {"type": "auto"}. OpenAI supports parallel function calling on GPT-5 and later for its built-in tools, and parallel_tool_calls: false if you specifically want at most one call per turn — built-in tools, notably, can't be batched into a parallel group regardless of that setting.
Check the date. OpenAI's own docs recommend gpt-5.6 for new Structured Outputs projects and note tool search is only available on gpt-5.4 and later; Claude's tool-use token overhead is published per current model generation. Both numbers move as new models ship — read the linked pages directly rather than treating the figures above as permanent.
Frequently asked questions
- Is Structured Outputs the same thing as the older JSON mode?
- No. OpenAI describes Structured Outputs as an evolution of JSON mode: JSON mode does not guarantee your schema is followed, Structured Outputs does. OpenAI's own comparison table recommends legacy JSON mode only for models predating gpt-4o-2024-08-06.
- What does strict mode actually require in the schema?
- For OpenAI: `additionalProperties: false` on every object, and every property listed in `required` — optional fields are expressed as a nullable type instead of being dropped from the required list. For Claude: adding `strict: true` to the tool definition.
- Does having more tools available always help the model?
- No. OpenAI's guidance explicitly recommends staying under roughly 20 available functions per turn for accuracy, and notes each definition is billed as input tokens whether or not it gets used that turn.
- Can I just force the model to call a specific tool?
- Yes on both platforms. Claude exposes this through the `tool_choice` parameter documented under forcing tool use; OpenAI's `parallel_tool_calls: false` setting can also be combined with an explicit tool choice to get exactly one call.
Sources
- Tool use with Claude — Anthropic
- Function calling — OpenAI
- Structured model outputs — OpenAI
- Introduction to Structured Outputs — OpenAI