Parameters
Structured output
Structured output constrains generation so the response conforms to a schema, rather than requesting a format and hoping.
Also written: JSON mode
Where a provider offers it, it removes an entire class of failure: no prose wrapper, no code fence, no missing key. It is enforcement rather than instruction.
Without it, the mitigation is an explicit output-format section naming the exact keys and stating that the response must contain nothing else.
In practice
Schema enforcement at the API level constrains decoding. Asking for JSON in the prompt does not, and the difference shows up at volume rather than in testing. Even with enforcement, handle the parse failure: something eventually arrives wrapped in a markdown fence, and the handler for that case should exist before it is needed.
Common questions
How do I make a model return valid JSON?
Use the API's schema enforcement rather than asking in the prompt. Enforcement constrains decoding; a polite request does not, and the difference appears at volume rather than in testing.
Do I still need to handle parse failures?
Yes. Something eventually arrives wrapped in a markdown fence or preceded by "Here is the JSON you requested". Define the path — repair, retry once, or fall back — before it happens rather than after.