API reference
Structured outputs
When you need machine-readable output, ask for JSON with response_format. Two modes: plain JSON mode, where the model must return valid JSON; and JSON schema, where the output is constrained to a shape you define. Both use the OpenAI response_format field.
JSON mode #
Set response_format to {"type": "json_object"} and the model returns syntactically valid JSON. Describe the fields you want in your prompt; JSON mode guarantees the output parses, not that it matches a particular shape.
curl https://api.merius.ai/v1/chat/completions \
-H "Authorization: Bearer $MERIUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen/qwen3-30b-a3b",
"response_format": {"type": "json_object"},
"messages": [
{"role": "user", "content": "Return name and city for Ada Lovelace as JSON."}
]
}'
JSON schema #
For a guaranteed shape, pass a json_schema. The model’s output is constrained to your schema, so every field you mark required is present and correctly typed — no post-validation needed for structure:
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "person",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"city": {"type": "string"}
},
"required": ["name", "city"]
}
}
}
Schema-constrained output depends on the model. The Models page notes which models advertise structured outputs; others still honor JSON mode.