Skip to main content

How do I get structured JSON output from the API?

Use response_format: { "type": "json_schema", "json_schema": { ... } } or response_format: { "type": "json_object" } in the request body. Not all models support json_schema, while json_object has wider support.

Did this answer your question?