OpenAI strict schema mode
OpenAI strict schema mode is the API flag that constrains GPT output to exactly match the supplied JSON schema — required fields, types, enums — making the model unable to emit invalid output.
In more detail
What it means
Introduced widely by OpenAI in late 2024 and now standard in 2026, strict mode enforces JSON Schema at decode time. Combined with response_format and a tools schema, it guarantees the model's output exactly matches what your downstream code expects — no retries, no partial-JSON parsing errors. Anthropic's tool-use, Google's response_schema, and Mistral's structured output mode are all equivalent patterns. The trade-off: deeply nested unions or recursive schemas can confuse smaller models. For most extraction and tool-use workloads, strict mode is the production default in 2026.
Part 1 of 2
When to use it, and when not
Use it for
- Extraction tasks.
- Tool / function call arguments.
- Any structured output downstream code parses.
Part 2 of 2
Common mistakes
- Deeply nested optional unions — smaller models drift.
- Schemas with very long enum lists — slows down the model and risks quality drift.
FAQ
Questions readers ask.
What is openai strict schema mode?
OpenAI strict schema mode is the API flag that constrains GPT output to exactly match the supplied JSON schema — required fields, types, enums — making the model unable to emit invalid output.
What does strict schema mode guarantee?
Output exactly matching the supplied JSON schema — required fields, types and enums — with no retries or partial-JSON parsing errors.
Which providers support strict structured output?
OpenAI strict mode, Anthropic tool-use, Google response_schema and Mistral structured output mode are equivalent patterns.
When does strict mode struggle?
Deeply nested unions or recursive schemas can confuse smaller models; keep schemas flat and enum lists short.
When should you use openai strict schema mode?
Extraction tasks. Tool / function call arguments. Any structured output downstream code parses.
What are the common mistakes with openai strict schema mode?
Deeply nested optional unions — smaller models drift. Schemas with very long enum lists — slows down the model and risks quality drift.
Last updated: 2026-09-29. Raw markdown: https://promtable.com/glossary/openai-strict-schema.md. Found a mistake? Tell us.