← All notes

OpenAI Structured Outputs: strict JSON Schema and the parse helper

Answer: Structured Outputs can be enabled by setting strict: true with either a defined response format or function definitions. Unlike JSON mode, Structured Outputs constrains the shape of the JSON, not only its validity.

Two ways to pass the schema

Refusals

A refusal does not follow the schema, so the API has a refusal field to indicate when the model refused to answer.

Pydantic side

BaseModel.model_json_schema returns a jsonable dict of a model's schema; Pydantic's generated schemas are compliant with JSON Schema Draft 2020-12.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: openai/openai-cookbook (GitHub), Introduction to Structured Outputs, MIT (https://raw.githubusercontent.com/openai/openai-cookbook/main/LICENSE). Copyright (c) 2025 OpenAI; pydantic/pydantic (GitHub), JSON Schema (Pydantic docs), MIT (https://raw.githubusercontent.com/pydantic/pydantic/main/LICENSE). Copyright (c) 2017 to present Pydantic Services Inc. and individual contributors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: openai/openai-cookbook (GitHub), Introduction to Structured Outputs, MIT (https://raw.githubusercontent.com/openai/openai-cookbook/main/LICENSE). Copyright (c) 2025 OpenAI; pydantic/pydantic (GitHub), JSON Schema (Pydantic docs), MIT (https://raw.githubusercontent.com/pydantic/pydantic/main/LICENSE). Copyright (c) 2017 to present Pydantic Services Inc. and individual contributors.

Cite this

Permanent ID: iil:note:287j0czt

iinventedlight. 2026. "OpenAI Structured Outputs: strict JSON Schema and the parse helper." iinventedlight Library, iil:note:287j0czt, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-structured-openai-structured-outputs/. License: CC-BY-4.0.

@misc{iil_note_287j0czt,
  author = {{iinventedlight}},
  title = {{OpenAI Structured Outputs: strict JSON Schema and the parse helper}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/ao-structured-openai-structured-outputs/},
  note = {Permanent ID iil:note:287j0czt. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-structured-openai-structured-outputs.md.