Structured output makes a language model return JSON that your code can parse instead of free text. JSON mode returns a syntactically valid JSON object, and JSON schema goes further by making the response match a schema you define, with its required fields and types.
Applications often need a model's answer as data: fields extracted from an invoice, a label for a support ticket, the steps of a plan, a record to save. Asking for JSON in the prompt works most of the time, but free text can arrive with an explanation before the JSON, a code fence around it, a missing field or a number written as a string. Each of those breaks a parser.
Structured output constrains the generation itself. The response is valid JSON, and with a schema it also has the exact shape you asked for.
There are two levels, both set with response_format:
{"type": "json_object"} makes the model return a valid JSON object. You describe the fields you want in the prompt, and the shape is not enforced.{"type": "json_schema", "json_schema": {...}} takes a name, a schema and strict, and makes the output conform to that JSON Schema: required fields present, types correct, and no extra keys when you set additionalProperties to false.Use JSON schema when the model supports it and your code depends on exact fields. Mark every field your code reads as required, use enum for fixed choices, keep nesting shallow, and add a short description to any field whose meaning is not obvious from its name.
For an invoice extractor, a schema might require vendor as a string, total as a number, currency as an enum of the codes you accept, and line_items as an array of objects with description and amount. With strict set to true, each response carries those fields with those types, so your code reads the same keys every time. With JSON mode, put a short example object in the prompt instead, so the model has a shape to follow.
Support is set per model. The structured_output field on GET /v1/models/{model} reads json_schema when the model supports schemas and json_object when it supports JSON mode only, and the models on this page show which level each one has. Sending a format the model does not support returns 400.
The same feature works on each text endpoint, in that endpoint's own shape:
/v1/chat/completions and /v1/completions: response_format./v1/responses: text.format./v1/messages: output_config.format, or a response_format next to the rest of the request.In the Playground, chat models that support it have an Off, JSON mode and JSON schema control, with a box for your schema. The compatibility guide has complete request examples.
finish_reason length, is incomplete JSON, so set max_tokens high enough for the largest object you expect.response_format answers without reasoning unless it also sets enable_thinking.Browse text models to compare which support each level.
62 models. Each model's page has its rate card, parameters and code.
| Model | Structured output | Context window |
|---|---|---|
| DeepSeek V4 Pro DeepSeek | JSON Schema | 1M tokens |
| DeepSeek V4 Pro 0813 DeepSeek | JSON Schema | 1M tokens |
| Fugu Max Sakana AI | JSON Schema | 1M tokens |
| Fugu Ultra v1.1 Sakana AI | JSON Schema | 1M tokens |
| Fugu Ultra v2.0 Sakana AI | JSON Schema | 1M tokens |
| Gemma 4 26B-A4B Google | JSON Schema | 256K tokens |
| Kimi K2.6 Moonshot AI | JSON Schema | 256K tokens |
| Kimi K2.7 Code Moonshot AI | JSON Schema | 256K tokens |
| Model | Structured output | Context window |
|---|---|---|
| Kimi K2.7 Code Highspeed Moonshot AI | JSON Schema | 256K tokens |
| Kimi K3 Moonshot AI | JSON Schema | 1M tokens |
| Kimi K3.1 Pro Moonshot AI | JSON Schema | 1M tokens |
| MiMo V2.6 Flash Xiaomi | JSON Schema | 1M tokens |
| MiMo V2.6 Pro Xiaomi | JSON Schema | 1M tokens |
| MiMo V2.6 Pro UltraSpeed Xiaomi | JSON Schema | 1M tokens |
| Mistral Small 3.1 Mistral AI | JSON Schema | 89.6K tokens |
| Muse Glimmer 30B Meta AI | JSON Schema | 128K tokens |
| Muse Spark 1.1 Meta AI | JSON Schema | 1M tokens |
| Muse Spark 1.2 Meta AI | JSON Schema | 1M tokens |
| Muse Spark 1.3 Meta AI | JSON Schema | 1M tokens |
| Qwen3.5 4B Alibaba Cloud | JSON Schema | 256K tokens |
| Qwen3.5 9B Alibaba Cloud | JSON Schema | 256K tokens |
| Qwen3.5 Omni Plus Alibaba Cloud | JSON Schema | 192K tokens |
| Qwen3.6 35B A3B Alibaba Cloud | JSON Schema | 128K tokens |
| Qwen3.7 Flash Alibaba Cloud | JSON Schema | 983.6K tokens |
| Qwen3.7 Max Alibaba Cloud | JSON Schema | 983.6K tokens |
| Qwen3.7 Plus Alibaba Cloud | JSON Schema | 983.6K tokens |
| Qwen3.8 27B Alibaba Cloud | JSON Schema | 256K tokens |
| Qwen3.8 Flash Alibaba Cloud | JSON Schema | 983.6K tokens |
| Qwen3.8 Max Alibaba Cloud | JSON Schema | 983.6K tokens |
| Qwen3.8 Max 0902 Alibaba Cloud | JSON Schema | 983.6K tokens |
| Qwen3.8 Omni Flash Alibaba Cloud | JSON Schema | 1.01M tokens |
| Qwen4 Max Alibaba Cloud | JSON Schema | 983.6K tokens |
| Seed 2.0 Lite ByteDance | JSON Schema | 229.1K tokens |
| Seed 2.0 Mini ByteDance | JSON Schema | 229.2K tokens |
| Seed 2.0 Pro ByteDance | JSON Schema | 229.1K tokens |
| Seed 2.1 Turbo ByteDance | JSON Schema | 229.1K tokens |
| Step 5 Preview StepFun | JSON Schema | 1.02M tokens |
| DeepSeek V4 Flash 0731 DeepSeek | JSON Mode | 1M tokens |
| DeepSeek V4.1 Flash 1017 DeepSeek | JSON Mode | 1M tokens |
| Fugu Ultra v1.0 Sakana AI | JSON Mode | 1M tokens |
| GLM 4.5 Flash Z.ai | JSON Mode | 128K tokens |
| GLM 4.6V Flash Z.ai | JSON Mode | 128K tokens |
| GLM 4.6V FlashX Z.ai | JSON Mode | 128K tokens |
| GLM 4.7 Flash Z.ai | JSON Mode | 202.8K tokens |
| GLM 4.7 FlashX Z.ai | JSON Mode | 202.8K tokens |
| GLM 5.1 Z.ai | JSON Mode | 202.7K tokens |
| GLM 5.2 Z.ai | JSON Mode | 1M tokens |
| GLM 5.3 Z.ai | JSON Mode | 1M tokens |
| GLM 5.3 Flash Z.ai | JSON Mode | 1M tokens |
| Mistral Small 4 Mistral AI | JSON Mode | 256K tokens |
| Qwen3.5 122B-A10B Alibaba Cloud | JSON Mode | 258K tokens |
| Qwen3.5 27B Alibaba Cloud | JSON Mode | 258K tokens |
| Qwen3.5 35B-A3B Alibaba Cloud | JSON Mode | 258K tokens |
| Qwen3.5 397B-A17B Alibaba Cloud | JSON Mode | 258K tokens |
| Qwen3.5 Flash Alibaba Cloud | JSON Mode | 995.9K tokens |
| Qwen3.5 Plus Alibaba Cloud | JSON Mode | 983.6K tokens |
| Qwen3.6 27B Alibaba Cloud | JSON Mode | 224K tokens |
| Qwen3.6 Flash Alibaba Cloud | JSON Mode | 983.6K tokens |
| Qwen3.6 Plus Alibaba Cloud | JSON Mode | 983.6K tokens |
| Step 3.7 Flash StepFun | JSON Mode | 256K tokens |
| StepAudio 2.5 Chat StepFun | JSON Mode | 256K tokens |
| StepAudio 3 Chat StepFun | JSON Mode | 256K tokens |
JSON mode returns a valid JSON object but leaves its shape to your prompt. JSON schema makes the response match a schema you supply, including required fields and types.
Support is per model. Each model's structured_output field reads json_schema for schema support or json_object for JSON mode only, and a request for an unsupported format returns a 400 error.
Yes. A response can be cut off by the output limit, and your application may have rules that a schema cannot express, so parse and validate every response.
Yes. The Responses endpoint uses text.format, and the Messages endpoint accepts output_config.format or a response_format field.
Check out our pricing or reach out if you want your own model deployed on our stack.