loading
loading
Constraining the model's response to a JSON schema so you get guaranteed-valid, parseable output instead of best-effort JSON.
Set output_config: {format: {type: "json_schema", schema: ...}} (or use the SDK's messages.parse() helper, which validates for you) to force the response to match your shape; strict: true on a tool definition does the same for tool inputs. New schemas incur a one-time compilation cost, then cache for 24 hours. This is the modern replacement for the old prefill trick (forcing JSON by starting the assistant turn) — prefills now 400 on current models. Note the constraints: no recursive schemas, no numeric/length bounds, every object needs additionalProperties: false, and it's incompatible with citations.
Plainly
Think of Structured Outputs as a simple recipe for doing the work better. Constraining the model's response to a JSON schema so you get guaranteed-valid, parseable output instead of best-effort JSON.
In practice
Use it when you need a repeatable method instead of guessing from vibes. In practice, define the owner, input, output, and failure mode before you rely on it.