Definition
Structured output is model output required to follow a machine-readable contract, such as a JSON Schema, grammar, enum, or typed response model. The contract defines allowed fields, types, nesting, and sometimes value constraints so downstream software can parse and validate the result without extracting meaning from free-form prose.
Implementations differ. A provider may use constrained decoding so invalid next tokens cannot be selected, train a model for schema following, validate and retry after generation, or combine these methods. The supported schema vocabulary also varies. A schema accepted by one provider or model may use features another endpoint rejects.
Origin and usage
Typed data formats, grammars, and schema validation long predate generative AI, so there is no credible single inventor of "structured output" in this setting. OpenAI's August 2024 Structured Outputs release helped standardize the current API distinction: JSON mode produces valid JSON, while strict structured output constrains a response to a developer-supplied schema. It also documented an important limit: a schema-valid value can still be wrong.
Operational significance
Structured output removes a class of syntax and parsing failures. It does not establish factual accuracy, authorization, or safe intent. A model can return the wrong account ID in a perfectly valid string field or choose a dangerous action from an allowed enum.
Consumers must also handle refusal, truncation, transport failure, and model-version incompatibility outside the success schema. Validate again at the application boundary and apply domain rules before any side effect.
Distinguish it from nearby terms
- JSON mode guarantees parseable JSON on APIs that support it, but may not enforce the application's schema.
- Function calling asks a model to select a named operation and provide arguments. Those arguments are a kind of structured output, but structured output need not request an action.
- Tool authorization decides whether a proposed operation may run. Schema conformance cannot grant permission.
Check your understanding
A response matches {"account_id": "string", "action": "close"} exactly but names the wrong customer. State what structured output guaranteed and the checks still required before execution.