Skip to content
AI Dev Toolkit.
Esc
  • AI Token CounterCount tokens for GPT, Claude, Gemini, DeepSeek, Qwen and more.Tool
  • LLM API Cost CalculatorEstimate per-request, daily and monthly API costs.Tool
  • AI Model ComparisonCompare prices, context windows and features across models.Tool
  • AI Model Pricing PagesSpecs, real costs and cheaper alternatives for popular models.Tool
  • Context Window CheckerSee whether your text fits each model’s context window.Tool
  • Subscription vs API CalculatorFind out whether a chat plan or the API is cheaper for you.Tool
  • GPU / VRAM CalculatorCheck how much VRAM a local model needs and which GPUs fit.Tool
  • Prompt Caching CalculatorEstimate savings from prompt caching.Tool

AI glossary · Agents and tools

What are structured outputs?

Also called: structured output, JSON Schema output, strict mode

Definition

Structured outputs is an LLM API feature that constrains the model’s reply to a JSON Schema you supply, so the response parses and has the fields and types you asked for, unlike JSON mode, which only promises valid JSON.

Explained

How it works

You send a schema with the request: text.format with type: "json_schema" and strict: true in OpenAI’s Responses API, output_config.format in Anthropic’s Messages API, and response_format with a schema in Gemini. Generation is then restricted to output that fits. Anthropic notes that the first request with a new schema is slower while its grammar compiles, and that compiled grammars are cached for 24 hours.

The guarantee has documented gaps. If the model refuses, or the reply hits the max output tokens limit, the output may not match the schema, so check for a refusal or an incomplete status (OpenAI) or the stop_reason (Anthropic) before parsing. Anthropic also notes that the capitalisation of enum values isn’t guaranteed. And every provider supports only part of JSON Schema.

Example

One schema, three sets of rules

A schema that works on one provider can fail on another. OpenAI requires every field to be listed in required (make one optional with a union such as ["string", "null"]) and supports minimum and maximum. Anthropic returns a 400 error for numeric limits such as minimum. Gemini accepts them but warns that very large or deeply nested schemas may be rejected.

Structured outputs also don’t check that values are true. A schema guarantees an email field holding a string, not the right email, so validate the content, and watch for hallucinated values in fields the source never mentioned.

Schema rules, as each provider documents them
RuleOpenAIAnthropicGemini
Every field in requiredYesNo (up to 24 optional parameters)Not stated
additionalPropertiesMust be falseMust be falseSupported
minimum / maximumSupported400 errorSupported
minLength / maxLengthNot listed400 errorNot listed
Size limits5,000 properties, 10 levels of nesting20 strict tools, 16 union-type parametersLarge or deep schemas may be rejected

From the OpenAI, Anthropic and Gemini structured output docs, 2026-10-11. “Not listed” means the docs don’t name it as supported.

Cost and quality

Why it matters

Without a schema, replies can come back malformed or missing fields, and each one costs a retry or a parser crash. With structured outputs on, you handle the documented edge cases (refusal, truncation) instead of guessing at broken JSON.

Don’t mix up

Common confusions

Structured outputs vs JSON mode
OpenAI’s JSON mode (type: "json_object") guarantees only that the output parses, not that it matches any schema, and the API returns an error unless the word “JSON” appears somewhere in the context. OpenAI calls Structured Outputs the evolution of JSON mode.
Structured outputs vs function calling
Both use JSON Schema. Function calling shapes the arguments of a tool call your code will run; structured outputs shape the reply itself. Anthropic’s strict tool use (strict: true) is the structured outputs guarantee applied to tool arguments.

Go deeper

Try it and read more

Related

All 40 terms in the AI glossary