Skip to main content
Use text.format when your application needs schema-shaped output instead of free-form prose. On the wire, the structured result still comes back as JSON text inside a normal message item. Choose this when downstream code depends on a predictable schema, not just “please answer in JSON” prompting.

Request

Response Shape

Choose the right mode

How To Read The Result

  • parse the JSON string from output[*].content[*].text
  • if you only need valid JSON and not schema enforcement, use text.format.type: "json_object" instead

Caveats

  • strict: true works best with a closed schema such as additionalProperties: false
  • the wire response remains item-based even when the output is structured
  • model support still depends on the selected model

Common mistakes

  • expecting a native JSON object instead of parsing the returned text
  • using an open schema when the app really needs closed, validated output
  • assuming every model supports strict schema following equally well