Structured outputs
Structured outputs constrain a model response to a declared schema so software receives expected fields and types instead of free-form prose.
Structured outputs turn a response format into a machine-readable contract. The developer supplies a schema describing properties, data types, required fields, arrays, and allowed values. Instead of hoping a prompt produces the right shape, the serving system restricts generation to responses that conform to the supported schema.
One implementation uses constrained decoding. After each token, the decoder calculates which tokens could still lead to valid output and blocks the rest. That is stronger than JSON mode, which ensures parseable JSON but not a particular set of keys or types. The result can be parsed directly into application objects when the SDK supports it.
The contract has boundaries. A valid amount field can still contain the wrong number. A safety refusal or a response cut short by a token limit may take a different path. Schema support also differs across providers and usually covers only a subset of JSON Schema. Applications still validate business rules, check important facts, and handle exceptional responses.
Software cannot safely depend on prose that changes shape from one response to the next.
Follow meeting notes into a typed action-item object.
- 1 · defineThe developer declares field names, types, required properties, and allowed values in a supported schema.
- 2 · sendThe application submits the schema with the user's unstructured input.
- 3 · constrainDuring generation, the decoder permits only next tokens that can still produce a schema-valid result.
- 4 · parseThe client parses the response into a typed object and handles refusals or incomplete generations separately.
Schema-valid means the container is shaped correctly; it does not mean every value is factually correct.
| Who | What they ask | What it works with |
|---|---|---|
| Operations team | “Turn these notes into assigned tasks” | An array of owner, task, and due-date objects |
| Ecommerce app | “Extract the requested product options” | Allowed product IDs, quantities, and variants |
| Support workflow | “Classify this ticket and set its priority” | Enumerated category and priority fields |
| Data pipeline | “Pull invoice values from this document” | Required vendor, amount, currency, and date fields |
- It can guarantee schema adherence for supported schemas when generation completes normally and is not a refusal.
- Programs can skip the validate-and-retry loop for badly formatted replies.
- Function calling can use a strict schema when the output represents arguments for a tool.
- The model can still put an incorrect fact or classification inside a valid field.
- Safety refusals and interrupted generations require explicit handling outside the normal object path.
- Providers support subsets of JSON Schema, so an arbitrary schema may need simplification.
Sources used
This explainer is written in original language. The links below support its factual claims.
- officialIntroducing Structured Outputs in the API, OpenAI · read 27 Sept 2026
- docsStructured model outputs, OpenAI · read 27 Sept 2026
- docsStructured outputs, Google AI for Developers · read 27 Sept 2026
- docsHow to use structured outputs with Azure OpenAI in Microsoft Foundry Models, Microsoft · read 27 Sept 2026
- officialJSON Schema — object, JSON Schema · read 27 Sept 2026