Structured outputs
Force JSON output with response_format. Two modes: json_object (any valid JSON) and json_schema (strict schema conformance). Examples in curl and Python.
The response_format parameter forces the model to return valid JSON. Two modes are supported.
json_object mode
The model guarantees the output is valid JSON. You define the structure in the system prompt.
curl https://getvibeapi.com/v1/chat/completions \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"response_format": { "type": "json_object" },
"messages": [
{"role": "system", "content": "Reply with JSON with fields: name (string), score (number)."},
{"role": "user", "content": "Rate this answer: very good"}
]
}'json_schema mode
Strict JSON Schema compliance — the model fills exactly the specified fields. Supported by GPT-5.x and compatible models.
curl https://getvibeapi.com/v1/chat/completions \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "review",
"strict": true,
"schema": {
"type": "object",
"properties": {
"name": { "type": "string" },
"score": { "type": "number", "minimum": 1, "maximum": 10 },
"summary": { "type": "string" }
},
"required": ["name", "score", "summary"],
"additionalProperties": false
}
}
},
"messages": [
{"role": "user", "content": "Rate this product: fast delivery, careful packaging"}
]
}'With
strict: true the gateway routes the request only to model variants that actually honour the schema, and it does so on every attempt — including a switch to a backup supplier. If no suitable variant is available right now you get an explicit structured_output_unsupported error rather than plain text where JSON was requested. That guard is built from measurements and covers only the variants we have measured: on an unmeasured variant the supplier may still discard the schema silently.Models differ on how well they hold JSON — check yours. Measured 2026-09-12 on
deepseek-v4-flash-0731, 10 calls per cell: json_object parsed 10/10 on the :cxa and :cxbc variants and 8/10 on :network, while a strict json_schema parsed 0/10 on both variants (:cxa answers 400, :cxbc answers 200 with plain text) and 3/10 on :network. DeepSeek's own API has no json_schema mode — use json_object, and when you need exactly one shape, a forced function call (tools + tool_choice) returned parseable arguments 10/10 on every variant. Per-variant numbers live in the structuredOutput field of GET /v1/model-capabilities. Each is a one-off reading stamped with its date (measurement: "point-in-time"), not a promise: the supplier behind a variant can change, and we do not re-measure on a schedule.Example response
{
"id": "chatcmpl-...",
"choices": [{
"message": {
"role": "assistant",
"content": "{\"name\":\"product X\",\"score\":9,\"summary\":\"Fast and convenient\"}"
},
"finish_reason": "stop"
}],
"usage": { "prompt_tokens": 42, "completion_tokens": 18, "total_tokens": 60 }
}