Strict mode (structured output)
Strict mode is OpenAI's constrained-decoding flag that guarantees model output conforms to a supplied JSON schema — the model literally cannot emit invalid syntax or violate the schema's shape.
Introduced by OpenAI in 2024 and widely available across providers in 2026 (Anthropic via tool use, Google via response_schema), strict mode enforces the JSON schema at decode time. Field types, required keys, allowed enums, and structure are all guaranteed. The trade-off: slightly more rigid responses on schemas with deep unions, and a small per-call overhead. For any output that downstream code parses, strict mode is the production default in 2026.
When to use strict mode (structured output)
- Extraction tasks.
- Tool / function calling.
- Any structured output where retry loops would otherwise be needed.
Common mistakes
- Deeply nested unions in the schema — smaller models get confused.
- Using strict mode without testing on real distribution — odd schema designs hurt quality.
FAQ
What is strict mode (structured output)?
Strict mode is OpenAI's constrained-decoding flag that guarantees model output conforms to a supplied JSON schema — the model literally cannot emit invalid syntax or violate the schema's shape.
When should I use strict mode (structured output)?
Extraction tasks. Tool / function calling. Any structured output where retry loops would otherwise be needed.
What are the most common mistakes with strict mode (structured output)?
Deeply nested unions in the schema — smaller models get confused. Using strict mode without testing on real distribution — odd schema designs hurt quality.
Related terms
- JSON mode (structured output) — JSON mode forces a language model to emit only syntactically valid JSON, usually conforming to a schema you supply.
- Structured output — Structured output is any production prompt pattern that forces a language model to return data in a deterministic, machine-parseable form (JSON, XML, custom).
- Function calling (tool use) — Function calling lets a language model emit a structured request to invoke a developer-defined tool, enabling reliable JSON output and agent workflows.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/strict-mode.md.