output_config.format.type
- Role
- Set to
json_schemato turn the constraint on.
Structured outputs make a model reply in JSON that matches your schema. The Claude and OpenAI parameters, documented schema limits, and the failure cases to handle.
Structured outputs constrain a model's reply to a JSON Schema you supply, so the result parses and carries the keys you asked for. Anthropic enables it with output_config.format of type json_schema; OpenAI uses text.format with strict: true. Both document cases where the output may not match: a refusal, or a reply cut off by a token limit.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
output_config.format.typejson_schema to turn the constraint on.schemarequiredadditionalProperties: falsefalse on objects. Claude's docs say any other value is unsupported.{"name": "John Smith", ...}.{
"model": "claude-opus-5-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Extract the key information from this email: John Smith (john@example.com) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm."}
],
"output_config": {
"format": {
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"email": {"type": "string"},
"plan_interest": {"type": "string"},
"demo_requested": {"type": "boolean"}
},
"required": ["name", "email", "plan_interest", "demo_requested"],
"additionalProperties": false
}
}
}
}output_config.format with type: "json_schema"text.format with type: "json_schema" and "strict": trueclient.messages.parse() with Pydantic in Python, zodOutputFormat() in TypeScriptstop_reason: "refusal", status 200, tokens billedrefusal item in the responsestop_reason: "max_tokens"max_output_tokens is reachedstrict: true on a tool definitionOpenAI describes structured outputs as the evolution of JSON mode. JSON mode guarantees valid JSON but not that it matches a schema, and OpenAI recommends structured outputs where available.
$ref, numeric constraints such as minimum and maximum, string constraints such as minLength and maxLengthminItems works only with 0 or 1anyOf or type arraysname or description does notenum or const values, so compare case-insensitivelyUse the request above with your API key. The reply text should be a JSON object with exactly the four keys.
Anything other than a normal end, such as refusal or max_tokens, means do not trust the shape.
If your schema has an enum, compare returned values case-insensitively, as Anthropic advises.
Anthropic says the first request with a new schema has extra latency while the grammar compiles.
1 questions people ask next, answered from the sources on this page.
No. OpenAI's docs say JSON mode guarantees valid JSON but not adherence to your schema, while structured outputs constrains the reply to the schema you supply. OpenAI recommends structured outputs whenever possible.
The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.