curl https://api.dottxt.ai/v1/chat/completions \
-H "Authorization: Bearer $DOTTXT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-oss-20b",
"messages": [{ "role": "user", "content": "Ship via UPS Ground to New York, estimated 4 days." }],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "shipping_response",
"schema": {
"anyOf": [
{
"type": "object",
"properties": {
"status": { "type": "string", "const": "success" },
"data": {
"type": "object",
"properties": {
"carrier": { "type": "string", "enum": ["ups", "fedex", "dhl"] },
"service": { "type": "string", "minLength": 1, "maxLength": 40 },
"estimated_days": { "type": "integer", "minimum": 1, "maximum": 30 }
},
"required": ["carrier", "service", "estimated_days"],
"additionalProperties": false
}
},
"required": ["status", "data"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"status": { "type": "string", "const": "error" },
"error": {
"type": "object",
"properties": {
"code": { "type": "string", "enum": ["missing_input", "ambiguous_request", "unsupported_region"] },
"message": { "type": "string", "minLength": 1, "maxLength": 200 },
"retryable": { "type": "boolean" }
},
"required": ["code", "message", "retryable"],
"additionalProperties": false
}
},
"required": ["status", "error"],
"additionalProperties": false
}
]
}
}
}
}'