Structured Outputs
Force the model to return JSON conforming to a schema by setting response_format with a json_schema definition.
curl -X POST http://localhost:18645/v1/responses -H 'Authorization: Bearer anything' -H 'Content-Type: application/json' -d '{
"model": "grok-4.3",
"input": [
{"role": "user", "content": "List 3 planets with their diameter in km."}
],
"text": {
"format": {
"type": "json_schema",
"name": "planets",
"schema": {
"type": "object",
"properties": {
"planets": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {"type": "string"},
"diameter_km": {"type": "number"}
},
"required": ["name", "diameter_km"]
}
}
},
"required": ["planets"]
}
}
}
}'