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 plan · Chrome extension included

Stop rewriting prompts. Start shipping.

Turn a rough idea into a structured prompt in one click, inside ChatGPT, Claude, Gemini and 40+ AI tools. 5 free prompts a day, no card. 4.8★ on the Chrome Web Store.

Create a free account