Messages API
POST /v1/messages
Compatible with the Anthropic Messages API. The gateway transparently proxies to Claude models via the configured Anthropic or Bedrock channel.
Request Body
| Parameter | Type | Description |
|---|---|---|
model* | string | ID of the model to use (e.g. claude-sonnet-4-6). |
messages* | array | Array of message objects with role (user/assistant) and content. |
max_tokens* | integer | Maximum number of tokens to generate. |
system | string | System prompt to set context for the conversation. |
stream | boolean | If true, return a stream of SSE events. Default: false. |
temperature | number | Sampling temperature 0–1. Default: 1. |
tools | array | List of tool definitions for tool use. |
Example Request
POST /v1/messages
Authorization: Bearer YOUR_API_KEY
x-api-key: YOUR_API_KEY
{
"model": "claude-sonnet-4-6",
"max_tokens": 256,
"messages": [
{"role": "user", "content": "What is the capital of France?"}
]
} Example Response
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-6",
"content": [
{ "type": "text", "text": "The capital of France is Paris." }
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 14,
"output_tokens": 9
}
} ℹ
The Messages API accepts both Authorization: Bearer and x-api-key headers for authentication, matching the Anthropic SDK convention.