Back to glossary
Techniques

Structured Output

API mode that guarantees the model returns valid JSON matching a schema.

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

Related terms

Free Chrome Extension

Stop rewriting prompts. Start shipping.

Works with ChatGPT, Claude, Gemini, Grok, Midjourney, Ideogram, Veo3 & Kling. 5.0★ on the Chrome Web Store.

Add to Chrome — Free