Skip to main content
Structured outputs make a model follow a JSON Schema definition that you provide as part of your inference API call. This approach contrasts with the older JSON mode feature, which guaranteed valid JSON but couldn’t ensure strict adherence to the supplied schema. Use structured outputs for function calling, extracting structured data, and building complex multi-step workflows.

JSON Schema support and limitations

Azure OpenAI structured outputs support the same subset of the JSON Schema as OpenAI.

Supported types

  • String
  • Number
  • Boolean
  • Integer
  • Object
  • Array
  • Enum
  • anyOf
Root objects can’t be the anyOf type.

All fields must be required

Include all fields or function parameters as required. In the following example, both location and unit appear under "required": ["location", "unit"].
If needed, you can emulate an optional parameter by using a union type with null. In this example, this approach is represented by the line "type": ["string", "null"],.

Nesting depth

A schema can have up to 100 object properties total, with up to five levels of nesting.

Always set additionalProperties: false in objects

This property controls if an object can have other key value pairs that weren’t defined in the JSON Schema. To use structured outputs, set this value to false.

Key ordering

Structured outputs follow the same order as the provided schema. To change the output order, modify the order of the schema that you send as part of your inference request.

Unsupported type-specific keywords

Nested schemas using anyOf must adhere to the overall JSON Schema subset

Example supported anyOf schema:

Definitions are supported

Supported example:

Recursive schemas are supported

Example using # for root recursion:
Example of explicit recursion:
Currently, structured outputs aren’t supported with:

Supported models

  • gpt-5.1-codex version: 2025-11-13
  • gpt-5.1-codex mini version: 2025-11-13
  • gpt-5.1 version: 2025-11-13
  • gpt-5.1-chat version: 2025-11-13
  • gpt-5-pro version 2025-10-06
  • gpt-5-codex version 2025-09-11
  • gpt-5 version 2025-08-07
  • gpt-5-mini version 2025-08-07
  • gpt-5-nano version 2025-08-07
  • codex-mini version 2025-05-16
  • o3-pro version 2025-06-10
  • o3-mini version 2025-01-31
  • o1 version: 2024-12-17
  • gpt-4o-mini version: 2024-07-18
  • gpt-4o version: 2024-08-06
  • gpt-4o version: 2024-11-20
  • gpt-4.1 version 2025-04-14
  • gpt-4.1-nano version 2025-04-14
  • gpt-4.1-mini version: 2025-04-14
  • o4-mini version: 2025-04-16
  • o3 version: 2025-04-16

API support

API version 2024-08-01-preview is the first version that supports structured outputs. The latest preview APIs and the latest GA API, v1, also support structured outputs.