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": "Send order confirmation to jane@acme.com via email." }],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "delivery_method",
"schema": {
"anyOf": [
{
"type": "object",
"properties": {
"delivery_method": { "type": "string", "const": "email" },
"email": { "type": "string", "pattern": "^[^@]+@[^@]+$" }
},
"required": ["delivery_method", "email"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"delivery_method": { "type": "string", "const": "sms" },
"phone": { "type": "string", "pattern": "^\\+?[1-9][0-9]{7,14}$" }
},
"required": ["delivery_method", "phone"],
"additionalProperties": false
}
]
}
}
}
}'