Structured outputs
Structured outputs
When you need JSON you can parse directly, use response_format.
JSON Schema (recommended)
JSON mode
To require valid JSON without a fixed schema:
In JSON mode, tell the model explicitly in the prompt that it must answer in JSON.
Notes
Strict schema enforcement depends on the model. Models without native support will try their best, so validate the output in your code. The Responses API takes the same structure in text.format; the gateway converts it for cross-protocol calls.