Messages
Messages
Validate Messages Request
Validate a chat completion request without executing it.
This endpoint performs a dry-run validation of the chat request, checking for:
- Message structure and content validation
- Tool definitions and tool_choice compatibility
- Parameter ranges and combinations
- Conversation flow and message ordering
- Response format compatibility with other options
Returns detailed validation results including errors. Use this endpoint to validate requests before sending them to the main chat endpoint.
Notes:
- No tokens are consumed during validation
- All validation rules match the main /messages endpoint
- Warnings indicate potential issues but don't prevent execution
- Request summary provides insights into the parsed request structure
post/v1/messages/validate
Request body
Example request
{
"max_tokens": 1000,
"messages": [
{
"content": "How do you fry an egg? Choose the best method.",
"role": "user"
}
],
"response_format": {
"type": "text"
},
"stream": false,
"system": {
"citations": {
"enabled": true
},
"text": "You are a helpful cooking assistant. Provide clear, step-by-step instructions."
},
"temperature": 0.7,
"thinking": {
"enabled": false
},
"tool_choice": {
"disable_parallel_tool_use": false,
"type": "auto"
},
"tools": [
{
"description": "A tool to fry eggs with precise temperature control",
"input_schema": {
"properties": {
"temperature": {
"description": "Temperature in degrees Celsius",
"type": "number"
},
"time": {
"description": "Time in minutes to fry the egg",
"type": "number"
}
},
"required": [
"temperature",
"time"
],
"type": "object"
},
"name": "egg_fryer"
}
]
}Response
Validation completed