Skip to main content

Structured output

Set response_format: { "type": "json_object" } on POST /v1/chat/completions to constrain the model to return JSON. Provide a JSON schema via response_format: { "type": "json_schema", "json_schema": {...} } to constrain the shape.

If the model produces invalid JSON, the response includes finish_reason: "length" (truncation) or the parsing error surfaces in the completion — validate on your side.

The response_format spec follows the OpenAI shape — see the interactive OpenAPI for the current supported subset.