Create a message
Changed onCreates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking.
Request
- Base URL: https://openrouter.ai/api/v1
- URL: https://openrouter.ai/api/v1/messages
- Auth: HTTP bearer
Headers
Opt-in level for surfacing routing metadata on the response under openrouter_metadata.
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,
"output_tokens_details": null,
"server_tool_use": null,
"service_tier": "standard"
}
}Changes
- info
added
armordiscriminator mapping keys to the/request property - info
added to the
/request propertyoneOflist
- info
- breaking
added the new required request property
//////// - breaking
added the new required request property
//////// - breaking
the
///////request property type changed fromstringtoobject - info
the
///////request property's minLength was decreased from1to0 - info
removed the pattern
^[^\n\r]*$from the request property///////
- breaking