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 this to 10 Main Street, Austin 78701 US. Use express please. Name: Alice Johnson, email alice@acme.com. No phone." }],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "order_payload",
"schema": {
"type": "object",
"properties": {
"customer": {
"type": "object",
"properties": {
"name": { "type": "string", "minLength": 1, "maxLength": 100 },
"email": { "type": "string", "format": "email" },
"phone": { "type": ["string", "null"], "pattern": "^\\+?[1-9][0-9]{7,14}$" }
},
"required": ["name", "email", "phone"],
"additionalProperties": false
},
"shipping": {
"type": "object",
"properties": {
"method": { "type": "string", "enum": ["standard", "express"] },
"address_line1": { "type": "string", "minLength": 1, "maxLength": 120 },
"city": { "type": "string", "minLength": 1, "maxLength": 80 },
"postal_code": { "type": "string", "minLength": 3, "maxLength": 20 },
"country": { "type": "string", "pattern": "^[A-Z]{2}$" }
},
"required": ["method", "address_line1", "city", "postal_code", "country"],
"additionalProperties": false
},
"notes": { "type": ["string", "null"], "maxLength": 300 }
},
"required": ["customer", "shipping"],
"additionalProperties": false
}
}
}
}'