Anthropic Messages
Create a message
Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking.
post/messages
Headers
X-OpenRouter-Metadata'disabled' | 'enabled'
Opt-in level for surfacing routing metadata on the response under openrouter_metadata.
Example:enabled
Opt-in to surface routing metadata on the response under openrouter_metadata. Defaults to disabled. The legacy header X-OpenRouter-Experimental-Metadata is also accepted for backward compatibility.
Request body
Example request
{
"max_tokens": 1024,
"messages": [
{
"content": "Hello, how are you?",
"role": "user"
}
],
"model": "anthropic/claude-4.5-sonnet-20250929",
"temperature": 0.7
}Response
Successful response
Example response
{
"container": null,
"content": [
{
"citations": [],
"text": "Hello! I'm doing well, thank you for asking.",
"type": "text"
}
],
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"model": "claude-sonnet-4-5-20250929",
"role": "assistant",
"stop_details": null,
"stop_reason": "end_turn",
"stop_sequence": null,
"type": "message",
"usage": {
"cache_creation": null,
"cache_creation_input_tokens": null,
"cache_read_input_tokens": null,
"inference_geo": null,
"input_tokens": 12,
"output_tokens": 15,
"server_tool_use": null,
"service_tier": "standard"
}
}