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": "Retrieve the details of order ORD-9842." }],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "tool_call",
"schema": {
"anyOf": [
{
"type": "object",
"properties": {
"tool": { "const": "search_docs" },
"query": { "type": "string", "minLength": 3, "maxLength": 200 },
"top_k": { "type": "integer", "minimum": 1, "maximum": 10 }
},
"required": ["tool", "query", "top_k"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"tool": { "const": "lookup_order" },
"order_id": { "type": "string", "pattern": "^ORD-[0-9]{4,10}$" }
},
"required": ["tool", "order_id"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"tool": { "const": "send_email" },
"to": { "type": "string", "format": "email" },
"subject": { "type": "string", "minLength": 3, "maxLength": 120 },
"body": { "type": "string", "minLength": 10, "maxLength": 1000 }
},
"required": ["tool", "to", "subject", "body"],
"additionalProperties": false
}
]
}
}
}
}'