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": "Invoice INV-22019\nVendor: Northwind Supplies\nDate: 2026-02-12\nCurrency: USD\nItems:\n- Battery Pack x2 @ 39.50 = 79.00\n- Cable Kit x1 @ 15.00 = 15.00\nTotal: 94.00" }],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "invoice_record",
"schema": {
"type": "object",
"properties": {
"invoice_id": { "type": "string", "minLength": 1, "maxLength": 40 },
"vendor": { "type": "string", "minLength": 1, "maxLength": 120 },
"invoice_date": { "type": "string", "format": "date" },
"currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
"total": { "type": "number", "minimum": 0 },
"line_items": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": {
"type": "object",
"properties": {
"description": { "type": "string", "minLength": 1, "maxLength": 200 },
"quantity": { "type": "number", "minimum": 0 },
"unit_price": { "type": "number", "minimum": 0 },
"line_total": { "type": "number", "minimum": 0 }
},
"required": ["description", "quantity", "unit_price", "line_total"],
"additionalProperties": false
}
}
},
"required": ["invoice_id", "vendor", "invoice_date", "currency", "total", "line_items"],
"additionalProperties": false
}
}
}
}'