In Claude /v1/messages, output_config.format constrains the final response text to a JSON Schema. Find the type: "text" block in content and parse its text as JSON: the first block may contain thinking.
{
"model": "claude-opus-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Extract the name and age: Anna, 29"}],
"output_config": {
"format": {
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"}
},
"required": ["name", "age"],
"additionalProperties": false
}
}
}
}{"name":"Anna","age":29}{
"model": "claude-opus-5",
"messages": [{"role": "user", "content": "Extract the name and age: Anna, age 29"}],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "person",
"strict": true,
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"}
},
"required": ["name", "age"],
"additionalProperties": false
}
}
}
}- Kimi. The
response_formatfield is accepted on/v1/chat/completionsand passed to the model as it is. Guard does not inject a schema of its own and does not validate the answer against yours, so parse the result on your side and handle the case where no JSON came back. - Composer and Grok. They have no
response_formatfield: a request carrying it gets400 cursor_parameter_unavailablebefore any charge. Ask for the format in the request text and check the answer on your side.
Guard does not currently declare a separate strict JSON Schema guarantee for GLM. Do not copy response_format or schema fields from another family without your own verification.
The confirmed way to receive typed data is a client tool with JSON Schema: the model returns function arguments, and the application validates them before execution.
{
"type": "function",
"function": {
"name": "save_invoice",
"description": "Save a validated invoice",
"parameters": {
"type": "object",
"properties": {
"code": {"type": "string"},
"amount": {"type": "number"}
},
"required": ["code", "amount"]
}
}
}- Describe the function and schema in the native shape for the selected API.
- Receive the tool call and parse its arguments as JSON.
- Validate the schema in your application; model output is not a validation boundary.
- Execute the action only after validation, then return the tool result.
See Client tools for the full roundtrip and ID-preservation rules.
Gemini returns JSON that follows a schema in all three APIs. Chat Completions uses response_format with type: "json_object" or type: "json_schema" and the schema in json_schema.schema; Responses uses text.format of the same form; Messages uses output_config.format. Google applies the schema.
Gemini does not accept the strict function mode strict: true: the request gets the error gemini_strict_tools_unsupported.
Guard passes the structured output fields to Meta unchanged: response_format in Chat Completions and text.format in Responses. The JSON schema mode is described in the Meta Model API documentation.