# Structured outputs

> Structured outputs make a model reply in JSON that matches your schema. The Claude and OpenAI parameters, documented schema limits, and the failure cases to handle.

Canonical: https://scaplet.com/glossary/structured-outputs

Glossary Glossary · AI search

Structured outputs make a model reply in JSON that matches your schema. The Claude and OpenAI parameters, documented schema limits, and the failure cases to handle.

2 min

read

2

sources

Oct 31, 2026

updated

Scaplet Editorial Team

author

In one line

Structured outputs constrain a model's reply to a JSON Schema you supply, so the result parses and carries the keys you asked for. Anthropic enables it with `output_config.format` of type `json_schema`; OpenAI uses `text.format` with `strict: true`. Both document cases where the output may not match: a refusal, or a reply cut off by a token limit.

30-second check

## Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fstructured-outputs%20(%22Structured%20outputs%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fstructured-outputs%20(%22Structured%20outputs%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fstructured-outputs%20(%22Structured%20outputs%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Fstructured-outputs%20(%22Structured%20outputs%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

## At a glance

4 facts from the sources below

output_config.format

Anthropic parameter

text.format with strict: true

OpenAI parameter

20 per request

Strict tool limit (Claude)

Refusals and truncated replies

Breaks the schema

_01_At a glance

## Anatomy of a schema-constrained request

Part

### `output_config.format.type`

Role

Set to `json_schema` to turn the constraint on.

Part

### `schema`

Role

The JSON Schema the reply must match.

Part

### `required`

Role

Keys that must appear in the object.

Part

### `additionalProperties: false`

Role

Must be `false` on objects. [Claude](/ai-search/anthropic/ads)'s docs say any other value is unsupported.

Part

### Response text block

Role

Contains JSON that matches the schema, such as `{"name": "John Smith", ...}`.

Claude request body, trimmed from Anthropic's docs

```
{ "model": "claude-opus-5-5", "max_tokens": 1024, "messages": [ {"role": "user", "content": "Extract the key information from this email: John Smith (john@example.com) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm."} ], "output_config": { "format": { "type": "json_schema", "schema": { "type": "object", "properties": { "name": {"type": "string"}, "email": {"type": "string"}, "plan_interest": {"type": "string"}, "demo_requested": {"type": "boolean"} }, "required": ["name", "email", "plan_interest", "demo_requested"], "additionalProperties": false } } } }
```

_02_At a glance

## Claude and OpenAI side by side

Question

### How to turn it on

Anthropic

`output_config.format` with `type: "json_schema"`

OpenAI

`text.format` with `type: "json_schema"` and `"strict": true`

Question

### SDK helpers

Anthropic

`client.messages.parse()` with Pydantic in Python, `zodOutputFormat()` in TypeScript

OpenAI

Helpers that take Pydantic, Zod or Sorbet definitions

Question

### Refusal signal

Anthropic

`stop_reason: "refusal"`, status 200, [tokens](/glossary/tokenization) billed

OpenAI

A `refusal` item in the response

Question

### Cut-off signal

Anthropic

`stop_reason: "max_tokens"`

OpenAI

An incomplete response, for example when `max_output_tokens` is reached

Question

### Tool alternative

Anthropic

`strict: true` on a tool definition

OpenAI

[Function calling](/glossary/tool-use), when the model needs to call your tools

[OpenAI](/ai-search/chatgpt/how-it-finds-sources) describes structured outputs as the evolution of JSON mode. JSON mode guarantees valid JSON but not that it matches a schema, and OpenAI recommends structured outputs where available.

_03_At a glance

## Documented limits (Claude)

Area

### Not supported

What the docs say

Recursive schemas, external `$ref`, numeric constraints such as `minimum` and `maximum`, string constraints such as `minLength` and `maxLength`

Area

### Arrays

What the docs say

`minItems` works only with 0 or 1

Area

### Complexity, per request

What the docs say

20 strict tools, 24 optional parameters in total, 16 parameters using `anyOf` or type arrays

Area

### Compilation

What the docs say

180-second timeout; schemas over internal limits return a 400 error

Area

### Grammar cache

What the docs say

Compiled grammars are cached for 24 hours from last use; changing structure invalidates the cache, changing `name` or `description` does not

Area

### Enums

What the docs say

Claude might change capitalization of `enum` or `const` values, so compare case-insensitively

**Check the stop reason before you parse**On a Claude refusal the output might not match your schema, because the refusal message takes precedence. On `max_tokens` the JSON may be incomplete. Anthropic's fix for truncation is to retry with a higher `max_tokens`. OpenAI likewise says to check for a `refusal` item and handle incomplete responses before parsing.

**Not the same as structured data on web pages**Structured outputs constrain what a model returns through an API. [Structured data](/glossary/structured-data) is markup that describes a page to search engines. They share a JSON vocabulary and nothing else.

_04_How it works

## Check it in 2 minutes

1. 01

### Send the example

Use the request above with your API key. The reply text should be a JSON object with exactly the four keys.
2. 02

### Read the stop reason

Anything other than a normal end, such as `refusal` or `max_tokens`, means do not trust the shape.
3. 03

### Test an enum

If your schema has an `enum`, compare returned values case-insensitively, as Anthropic advises.
4. 04

### Time the first call

Anthropic says the first request with a new schema has extra latency while the grammar compiles.

Questions

## Asked a lot.

1 questions people ask next, answered from the sources on this page.

_01_ Is structured outputs the same as JSON mode?

No. OpenAI's docs say JSON mode guarantees valid JSON but not adherence to your schema, while structured outputs constrains the reply to the schema you supply. OpenAI recommends structured outputs whenever possible.

Sources · 2

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- claude.com
- openai.com

1. 01 [Structured outputs (Claude docs)](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) platform.claude.com · checked 2026-11-01
2. 02 [Structured outputs (OpenAI developer docs)](https://developers.openai.com/api/docs/guides/structured-outputs) developers.openai.com · checked 2026-11-01

## Keep learning

[All glossary](/glossary)

[Learn System prompt AI search](/glossary/system-prompt) [Related Structured data Structured data](/glossary/structured-data) [Read next Temperature AI search](/glossary/temperature) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in glossary
[Striking distance keywords](/glossary/striking-distance-keywords) [Structured data](/glossary/structured-data) [Subdomain vs subdirectory](/glossary/subdomain-vs-subdirectory) [SVG](/glossary/svg)

More in AI search
[Generative engine optimization](/glossary/generative-engine-optimization) [Grounding](/glossary/grounding) [Knowledge cutoff](/glossary/knowledge-cutoff) [Large Language Model](/glossary/large-language-model) [Model Context Protocol](/glossary/model-context-protocol) [Multimodal AI](/glossary/multimodal-ai) [Prompt caching](/glossary/prompt-caching) [Prompt engineering](/glossary/prompt-engineering) [Prompt tracking](/glossary/prompt-tracking) [Reranking](/glossary/reranking) [Retrieval-Augmented Generation](/glossary/retrieval-augmented-generation) [Semantic Search](/glossary/semantic-search) [Structured outputs](/glossary/structured-outputs) [System prompt](/glossary/system-prompt) [Temperature](/glossary/temperature) [Tokenization](/glossary/tokenization) [Tool use](/glossary/tool-use) [Vector search](/glossary/vector-search) [AI Agents](/glossary/ai-agents) [AI citations](/glossary/ai-citations) [AI detection](/glossary/ai-detection) [AI Hallucination](/glossary/ai-hallucination) [AI Mode](/glossary/ai-mode) [AI Overviews](/glossary/ai-overviews)

Terms on this page
[Tokenization](/glossary/tokenization) [Tool use](/glossary/tool-use) [Structured data](/glossary/structured-data)

Free · 2 minutes

## Know the term. _Now check your site._

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **+212%** organic clicks in 90 days Ledgerly
