Overview
Structured Outputs force the model’s response to strictly follow a JSON Schema you define, ensuring the return value can be parsed directly by your program without regex or post-processing. Unlike asking the model to “please return JSON” in the prompt, Structured Outputs rely on Constrained Decoding: the upstream provider compiles the JSON Schema into grammar rules and constrains generation token-by-token during inference, making it impossible for the model to produce output that violates the schema. Typical use cases:- Extracting entities and fields from unstructured text
- Classification / labeling / sentiment analysis
- Standardized passing of intermediate results in multi-step reasoning
- Strongly-typed constraints on Agent tool call parameters
Protocol Parameter Comparison
The parameter names differ across the three protocols, but the underlying mechanism is the same: the model output strictly matches the JSON Schema you provide.
| Protocol | Parameter | Supported Models |
|---|---|---|
OpenAI Chat /v1/chat/completions | response_format.type: "json_schema" | Claude 4.5+, GPT-4o / GPT-5 series, Gemini series |
Anthropic Messages /v1/messages | output_config.format.type: "json_schema" | Claude 4.5+ (direct / Vertex); Bedrock 4.5—4.6 only |
OpenAI Responses /v1/responses | text.format.type: "json_schema" | Depends on upstream model capabilities |
AWS Bedrock Limitations
Claude 4.7 and above on AWS Bedrock uses the Mantle inference path, which does not currently supportoutput_config.format. The gateway automatically strips the format field for these models and marks the degradation in a response header (see Auto-Degradation Mechanism below). Your request will not fail because of this.
Quick Start
OpenAI Protocol (Recommended)
Works with all models that support Structured Outputs, across providers.Using Other Models (GLM-5.2 Example)
The same OpenAI protocol parameters work with all models that support Structured Outputs — just switch themodel.
Python
Claude Native Protocol
Call directly with the Anthropic SDK using theoutput_config.format parameter.
Schema Writing Guidelines
Required Fields
Allobject types must explicitly declare additionalProperties: false; otherwise some upstream providers will reject the request.
Nested Objects
Nestedobject types also require additionalProperties: false:
Cross-Protocol Schema Differences
| Feature | OpenAI Protocol | Anthropic Protocol |
|---|---|---|
name field | Required | Not supported (automatically handled by the gateway during cross-protocol calls) |
strict field | Optional, recommended true | Not supported |
Numeric constraints (minimum, maximum, etc.) | Supported | Not supported (automatically stripped by the gateway; does not affect the request) |
String constraints (minLength, maxLength) | Supported | Not supported (automatically stripped by the gateway) |
Auto-Degradation Mechanism
The gateway enables auto-degradation protection for Structured Outputs on all requests by default. When the model or platform does not support it, the gateway will not return an error. Instead, it automatically strips the Schema constraint and marks the degradation reason in a response header. Your request will still receive a normal model response — the output simply won’t be strictly constrained by the Schema. This means you can safely enable Structured Outputs uniformly on the client side without having to check compatibility for each model:- Seamless multi-model switching: When switching models between Claude, GPT, Gemini, and GLM with the same codebase, requests won’t fail even if the target model doesn’t support Structured Outputs
- Transparent fallback routing: When the primary channel is unavailable and fallback routing redirects to a backup channel, even if the backup channel’s model version doesn’t support Structured Outputs, the request still completes normally
- Simplified client logic: No need to maintain a list of “which models support Structured Outputs” — the gateway handles it automatically; the client only needs to check the response header to decide whether additional parsing is needed
Response Header
| reason | Meaning |
|---|---|
model_unsupported | The model (or the model on its current platform) does not support Structured Outputs |
json_object_unsupported_on_anthropic | json_object mode cannot be converted to the Anthropic format |
json_schema_missing_schema | json_schema type was specified but the schema field is missing |
schema_keywords_stripped | Some constraint keywords in the Schema were stripped (e.g., minimum, maxLength) |
Detection Example
Python
Difference from json_object Mode
json_schema (Structured Outputs) | json_object | |
|---|---|---|
| Output guarantee | Strictly matches the specified Schema | Only guarantees valid JSON |
| Field control | Field names, types, and required status are all constrained | No constraints |
| Supported protocols | OpenAI / Anthropic / Responses | OpenAI-compatible protocols only |
| Claude support | Via output_config.format | Not supported |
FAQ
Which models support Structured Outputs?
Which models support Structured Outputs?
Claude series (via Anthropic API’s
output_config.format):- Opus / Sonnet / Haiku 4.5 and above
- Fable / Mythos 5 and above
- Bedrock platform: 4.5—4.6 only; Vertex AI matches direct API support
response_format):- GPT-4o and above, GPT-5 series
responseSchema):- Gemini 2.5 and above
Why don't some Claude models on Bedrock support Structured Outputs?
Why don't some Claude models on Bedrock support Structured Outputs?
Claude 4.7+ on AWS Bedrock uses the new Mantle inference path, which does not currently accept the
output_config.format parameter. The gateway handles this automatically: it strips the format field and returns a normal response while marking the degradation header X-Structured-Output-Degraded: model_unsupported. Claude 4.5—4.6 on Bedrock is fully supported.Is the JSON Schema modified during cross-protocol calls?
Is the JSON Schema modified during cross-protocol calls?
Yes. When calling Claude models via the OpenAI protocol, the gateway automatically:
- Converts
response_formattooutput_config.format - Removes Schema keywords not supported by Anthropic (
minimum,maxLength, etc.) - Marks
schema_keywords_strippedin the response header if any keywords were stripped
Can Structured Outputs be used together with Extended Thinking?
Can Structured Outputs be used together with Extended Thinking?
Yes. The
format (Structured Outputs) in output_config and the effort (thinking intensity) in reasoning are independent parameters that can be set simultaneously:How does the degradation mechanism compare to other aggregation platforms like OpenRouter?
How does the degradation mechanism compare to other aggregation platforms like OpenRouter?
Most API aggregation platforms return an error outright when a model does not support Structured Outputs. AIHubMix uses a graceful degradation strategy: it automatically strips incompatible parameters, returns the model response normally, and informs the client of the degradation reason via the
X-Structured-Output-Degraded response header. Your application will not break because of this.