Structured outputs
Get JSON back from Merius models. Use response_format for JSON mode or a JSON schema so responses parse reliably.
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": "z-ai/glm-5.1",
"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 endpoint notes which models advertise structured outputs; others still honor JSON mode.
Function calling
Let Merius models call your functions. Define tools in the OpenAI format, receive tool_calls, run them, and feed the results back.
Use with your tools
Point Cursor, Cline, Claude Code, and Continue at Merius. Because the API is OpenAI-compatible, set the base URL and key — no custom plugin.