Structured Output
Forcing a language model's response to fit a specific JSON schema or grammar.
Structured output is the difference between 'we hope the model gives us valid JSON' and 'the runtime guarantees it'. Modern APIs (OpenAI, Anthropic, Gemini) support this natively you provide a JSON schema and the response is constrained to fit.
Under the hood, structured output uses constrained decoding: at each token, only tokens that keep the output schema-valid are sampled. This is far more reliable than asking nicely in the prompt.
For most production AI features forms, extraction, classification, tool calls structured output is the difference between flaky and rock-solid. Pair it with Zod / Pydantic schemas and you get end-to-end type safety.