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": "Issue a $25 refund for order ORD-9842 because the customer was charged twice." }],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "api_call",
"schema": {
"oneOf": [
{
"type": "object",
"properties": {
"endpoint": { "const": "get_order" },
"method": { "const": "GET" },
"path": { "const": "/orders/{order_id}" },
"path_params": {
"type": "object",
"properties": {
"order_id": { "type": "string", "pattern": "^ORD-[0-9]{4,10}$" }
},
"required": ["order_id"],
"additionalProperties": false
}
},
"required": ["endpoint", "method", "path", "path_params"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"endpoint": { "const": "create_refund" },
"method": { "const": "POST" },
"path": { "const": "/refunds" },
"body": {
"type": "object",
"properties": {
"order_id": { "type": "string", "pattern": "^ORD-[0-9]{4,10}$" },
"amount": { "type": "number", "minimum": 0.01 },
"reason": { "type": "string", "enum": ["duplicate", "fraud", "requested_by_customer", "other"] }
},
"required": ["order_id", "amount", "reason"],
"additionalProperties": false
}
},
"required": ["endpoint", "method", "path", "body"],
"additionalProperties": false
}
]
}
}
}
}'