Definition
Structured output is an API mode (OpenAI's response_format, Anthropic's tool use, Gemini's responseSchema) that guarantees the model returns valid JSON matching a provided schema. Unlike free-text JSON prompting which usually works but occasionally fails, structured output mode validates and retries internally. Critical for production AI pipelines that ingest model output into typed systems.
Example
OpenAI: response_format: { type: 'json_schema', json_schema: { ... } }. Output: always valid JSON matching the schema.
When to use
Production AI, downstream systems consuming JSON, when invalid output cannot be tolerated.
Also known as
structured outputs