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.
Standard JSON mode forces valid syntax but allows the model to invent fields. JSON Schema mode (strict) additionally enforces the field shape: required keys, field types, allowed enums, nested object structure. The decoder cannot emit output that violates the schema. Production LLM apps in 2026 default to JSON Schema mode for any output downstream code parses — extraction, classification, tool-call arguments. Trade-off: deep unions or recursive schemas can confuse smaller models; keep schemas reasonably flat.
When to use json schema mode (strict)
- Production extraction tasks.
- Tool / function call arguments.
- Anywhere code downstream parses the model's output.
Common mistakes
- Deeply nested optional fields — smaller models drift on shape.
- Skipping schema validation server-side — strict mode reduces but does not eliminate edge-case failures.
FAQ
What is 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.
When should I use json schema mode (strict)?
Production extraction tasks. Tool / function call arguments. Anywhere code downstream parses the model's output.
What are the most common mistakes with json schema mode (strict)?
Deeply nested optional fields — smaller models drift on shape. Skipping schema validation server-side — strict mode reduces but does not eliminate edge-case failures.
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.
- 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.
- 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/json-schema-mode.md.