format

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)

Common mistakes

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.

Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/json-schema-mode.md.