/messages
Send and receive messages using Anthropic's API format. This endpoint is compatible with Claude and other Anthropic-style APIs.
/v1/messagesSend a structured list of input messages and receive a model-generated message.
Request Body
modelThe model to use (required)messagesArray of message objects (required)max_tokensMaximum tokens to generate (required)systemSystem instructions or context (optional)streamEnable server-sent events streaming (optional)temperatureSampling randomness control (optional)toolsAvailable functions for tool use (optional)tool_choiceTool invocation behavior (optional)reasoningThinking (reasoning) control (optional): {"effort": "low"} sets the level, {"max_tokens": 2000} caps thinking tokens, {"enabled": false} turns it off. Supported models and defaults: see Reasoning Control{
"model": "your-model",
"max_tokens": 1024,
"system": "You are a helpful assistant.",
"messages": [
{"role": "user", "content": "Hello!"}
],
"reasoning": {"effort": "low"}
}Anthropic's thinking parameter ({"type": "enabled", "budget_tokens": ...} / {"type": "disabled"}) has no effect on OpenRouter-routed models: on 2026-09-03 a kimi-k3 request with {"type": "disabled"} still returned a thinking block. Use the reasoning object on this endpoint as well.
Response
Returns a message object with content array, model identifier, stop reason, and token usage metrics.
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"model": "your-model",
"content": [
{"type": "thinking", "thinking": "The user greeted me..."},
{"type": "text", "text": "Hello! How can I help you today?"}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 20,
"output_tokens": 45
}
}On reasoning models the thinking comes back as a {"type": "thinking"} block in the content array ahead of the text block (thinking_delta when streaming). Those tokens are counted in usage.output_tokens and bill at the output rate.