🎁 New Sign up free, 10 calls on us. Up to $1, no card needed.

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

ParameterTypeDescription
model*stringID of the model to use (e.g. claude-sonnet-4-6).
messages*arrayArray of message objects with role (user/assistant) and content.
max_tokens*integerMaximum number of tokens to generate.
systemstringSystem prompt to set context for the conversation.
streambooleanIf true, return a stream of SSE events. Default: false.
temperaturenumberSampling temperature 0–1. Default: 1.
toolsarrayList 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.