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.
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.
When to use openai strict schema mode
- Extraction tasks.
- Tool / function call arguments.
- Any structured output downstream code parses.
Common mistakes
- Deeply nested optional unions — smaller models drift.
- Schemas with very long enum lists — slows down the model and risks quality drift.
FAQ
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.
When should I use openai strict schema mode?
Extraction tasks. Tool / function call arguments. Any structured output downstream code parses.
What are the most 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.
Related terms
- 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.
- JSON mode (structured output) — JSON mode forces a language model to emit only syntactically valid JSON, usually conforming to a schema you supply.
- JSON Schema mode (strict) — JSON Schema mode is the API feature — OpenAI strict mode, Anthropic tool-use schemas, Gemini response_schema — that constrains a language model's output to match a supplied JSON Schema at decode time.
- 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/openai-strict-schema.md.