Cost
The schema does not remove the tokens in the prompt. It can save a later turn whose only job was to fix the shape.
Map · Foundations · 07 · Structured Outputs
Concept card · Foundations
Structured outputs ask the model for a reply that follows a schema, such as named fields, so code can read it.
Asking for a reply that follows a shape, such as fields you name, so code can read it.
Oct 17: First card. The picture shows a reply that matches a schema and JSON that is missing a field. Sources are the OpenAI, Anthropic, and Gemini structured output guides.
A schema names the fields and the types you expect, for example a name and a status. Structured outputs tell the API to keep the reply inside that shape. A sentence can hold the same facts and still be hard for code to read.
The schema does not remove the tokens in the prompt. It can save a later turn whose only job was to fix the shape.
Code can read a field by name. Prose has to be parsed, and a small wording change can break that parse.
A schema constrains the shape, not the truth of the values. A field can be present and still be unsupported by the source.
Take one reply you parse by hand. Write down the fields you actually read, and request those fields with the provider's schema option.
Treating the words "return JSON" in a prompt, or a mode that only checks that the text is JSON, as the same thing as a schema the API enforces.
Code needs a name and a status. What should you send?
Coming soon. One reply you already parse, rewritten as a schema with the fields you read.
Coming soon. How OpenAI, Anthropic, and Gemini each attach a JSON schema to a request.