In short.
OpenAI's Structured Outputs guide is for developers building applications that consume AI responses as data, but matching a schema does not guarantee accurate content or successful completion. It explains strict JSON Schema formats, typed SDK helpers, streaming and response-format changes during a conversation. Its practical value is clear integration guidance; its limits include a restricted schema language, unmeasured performance and inconsistencies in some examples.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete supplied learning resource at [https://developers.openai.com/api/docs/guides/structured-outputs.md], including its embedded examples and schema restrictions. No explicit licence or reuse notice appears in the supplied text. Linked documentation, repositories, cookbooks and other pages are excluded. No code or API requests were executed; performance, runtime behavior and task accuracy remain unassessed.
The overview
Resource identity
This is OpenAI's documentation guide titled Structured model outputs, available at [https://developers.openai.com/api/docs/guides/structured-outputs.md]. It teaches developers how to constrain model responses to a supported JSON Schema, which describes permitted fields, types and values.
The guide focuses on non-function-calling use cases in the Responses API. It also explains when function calling is appropriate and compares Structured Outputs with JSON mode.
Practical assessment
This is a useful implementation reference for replacing loosely formatted model answers with data that application code can consume. It connects schema design to request configuration, typed parsing and failure handling, with examples in Python, JavaScript or TypeScript, Go, Java, C#, Ruby and curl.
The documentation supports understanding the intended interface, but provides no measured extraction accuracy, reliability benchmark or quantified latency. Some displayed results and schema examples are inconsistent, so developers should reconcile them before reuse.
Who it helps
The guide suits developers extracting fields from text, classifying inputs, building structured tutoring responses or generating component data for an interface. Beginners benefit most once they can read JSON and make a basic API request. Experienced developers can use the schema restrictions and response-handling examples to plan an integration.
It requires application code to submit requests and consume results. It does not provide a ready-made extraction application, UI renderer or moderation service.
What it covers
Examples cover calendar-event extraction, research-paper metadata, structured math explanations, recursive UI component trees and moderation classifications. Schema features include nested objects, arrays, enums, nullable fields, definitions, references and recursion.
The guide documents streaming text and refusal events. For supported GPT-6 and later models in standard single-agent mode, it also describes configuration_update items that replace the response format during a conversation. Each update replaces the whole format and remains effective across later turns.
Using it
Requirements
Using the examples requires OpenAI API credentials, access to a compatible model and an HTTP client or suitable SDK. Python's typed examples use Pydantic, JavaScript and TypeScript use Zod, and Ruby's typed helper uses Sorbet. Developers can also supply JSON Schema directly.
The page identifies gpt-4o-mini and gpt-4o-2024-08-06 or later as supporting schema response formats, and uses gpt-6-astra in its main examples. Minimum SDK and runtime versions, and access for a particular account, are not established.
How it works
In the Responses API, a request supplies text.format with type set to json_schema, a schema name, the schema itself and strict set to true. SDK helpers can derive schemas from language-level types and expose parsed results. The documented guarantee applies to completed, non-refusal output that follows the supported schema.
The root schema must be an object and cannot use anyOf at the top level. Every field must be required, and every object must set additionalProperties to false. A field can represent an absent value by permitting null. Output keys follow schema order.
A configuration update introduces a further parsing detail: the response object's text.format still reports the original request-level format. After checking completion and refusal status, the application must parse using the latest effective schema.
Getting started
Define a small object schema for the information your application needs. Give fields clear names and descriptions, require each field, disallow additional properties and explicitly represent missing information. Supply it through text.format or the corresponding SDK parsing helper.
Before consuming a parsed result, check response completion, refusal content and missing output. Handle API errors and incomplete responses, including output-token limits and content filtering. Then validate factual content and application rules that the schema cannot express.
The guide recommends generating schemas from native types where possible to reduce divergence between application types and API schemas. It also recommends evaluating schema choices against the intended task.
A concrete example
The calendar example supplies a sentence about Alice and Bob attending a science fair on Friday. Its schema requests name and date as strings and participants as an array of strings. Python passes a Pydantic CalendarEvent class to responses.parse; JavaScript uses zodTextFormat and reads output_parsed.
This illustrates extracting fields into a predictable shape. Because date is only a string in this example, the schema does not require a calendar-date format or establish which Friday the input means. No execution result is established here.
Assessment & evidence
Limits and pitfalls
Schema adherence does not establish factual accuracy. The guide warns that unrelated input can lead to invented content as the model tries to fill required fields. Refusals can fall outside the requested schema, and interrupted responses can be incomplete. Streaming text or an output-text-done event alone does not establish successful completion.
The documented schema limits include 5,000 object properties, 10 nesting levels, 120,000 characters across property names, definition names, enum values and const values, and 1,000 enum values overall. A single string enum with more than 250 values has an additional 15,000-character limit.
Unsupported constructs include allOf, not, dependentRequired, dependentSchemas and conditional keywords. Fine-tuned models have further restrictions on string, numeric and array constraints. Unsupported schemas submitted with strict enabled produce an API error.
Nullable enum examples need particular care. The curl moderation schema omits null from the category enum, while several SDK examples include it and the displayed result uses null. Similar omissions appear in unit examples. These definitions should be reconciled before copying them.
Fit and tradeoffs
The guide is most useful when an application already knows the shape of the answer it needs. Required fields, known category values and typed parsing can simplify the boundary between model output and ordinary application code.
A schema can require a title string or a permitted category, but cannot by itself establish that the title came from the input or that the classification is correct. The integration therefore needs both structural constraints and checks appropriate to the task. For freely written answers, the extra schema design and parsing may offer less value.
Related approaches
JSON mode, enabled with text.format type json_object, targets valid JSON without guaranteeing a particular schema. The guide presents it as an option where Structured Outputs is unavailable, with application-side validation and potentially retries. It also requires an explicit instruction to produce JSON and handling for incomplete output.
Function calling is the related approach for connecting a model to application functions, tools or data. Structured text.format is appropriate when the model's response itself needs a defined structure. Detailed function-calling implementation and comparisons with other providers are outside this page's scope.
Evidence and example quality
The evidence is the complete supplied OpenAI guide at [https://developers.openai.com/api/docs/guides/structured-outputs.md]. Its explanations, code blocks and displayed responses document intended usage. Nothing was executed, so runtime compatibility, latency, reliability and task accuracy are not assessed.
Some displayed responses do not correspond to the explicit inputs. The research-paper result describes an interstellar-navigation paper, whereas several language examples supply text about the Transformer paper. The displayed UI result also differs from the exact-three-direct-children request in the TypeScript and C# examples. These are illustrations of data shapes, not verified input-to-output pairs.
Access & freshness
Costs and latency
The page gives no token prices, free-use allowance or separate Structured Outputs charge. API spending and any feature-specific fee are unknown from this resource.
It states that the first request with a schema incurs additional processing latency, while subsequent requests with the same schema avoid that additional latency. The size of that delay and overall response times are not quantified.
Licence and reuse
The supplied page contains no explicit licence or reuse notice for its documentation text or embedded examples. Redistribution permission and any attribution obligations are unknown. Licences for the linked SDK repositories are not included in this evidence.
Currency
The supplied source snapshot was captured on 13 November 2026 at 22:52:14 UTC. The page does not state a publication or last-update date.
Its examples use gpt-6-astra and include response-format updates for supported GPT-6 and later models. Model availability, SDK signatures and documented limits after the capture are unknown.
Suggested next steps
Start with one task and a small schema. Encode missing values explicitly, ensure nullable enums permit null, and confirm that the chosen model and SDK support the required features. Correct the example discrepancies before adapting their code.
Evaluate representative inputs, missing information and unrelated text, along with refusal and incomplete-response handling. Check content accuracy separately from schema validity. For streaming, wait for the final response status before treating data as complete; for format updates, track the effective schema explicitly. These are recommended checks, not completed tests.
Establish applicable API pricing and reuse terms separately, since this page does not provide them.
