Skip to main content
POST
Send a message to Anthropic models using the native Anthropic Messages API format. Supports streaming and non-streaming responses.

Create Anthropic Message

To create an Anthropic message, use the following endpoint: POST /v1/messages
This endpoint is compatible with the Anthropic SDK (anthropic Python/Node.js package). Point your SDK at https://api.routeway.ai and replace your Anthropic API key with your Routeway key — no other changes needed.

Request Body

string
required
The Anthropic model ID to use (e.g. "claude-opus-4-5", "claude-sonnet-4-5"). See Models for the full list of supported Anthropic models.
array
required
An array of message objects forming the conversation. Each object must have a role ("user" or "assistant") and a content field (string or array of content blocks).
integer
required
The maximum number of tokens to generate before stopping.
string | array
A system prompt that provides context and instructions to the model. Can be a plain string or an array of content blocks.
number
Sampling temperature between 0 and 1. Higher values produce more varied outputs.
boolean
Whether to stream the response as Server-Sent Events (SSE).
array
Custom text sequences that will cause the model to stop generating.
array
A list of tools the model may call. Each tool must have a name, optional description, and an input_schema (JSON Schema object).
object
Controls tool use. Can be {"type": "auto"}, {"type": "any"}, or {"type": "tool", "name": "..."}.
number
Nucleus sampling parameter. Use temperature or top_p, but not both.
integer
Only sample from the top K options for each subsequent token.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-api-key
string

Body

application/json
model
string
required
max_tokens
integer
required
messages
Message · object[]
required
system
stream
boolean | null
default:false
temperature
number | null
Required range: 0 <= x <= 2
top_p
number | null
Required range: 0 <= x <= 1
top_k
integer | null
Required range: x >= 0
stop_sequences
string[] | null
tools
ToolDefinition · object[] | null
tool_choice
ToolChoiceAuto · object
disable_parallel_tool_use
boolean | null
thinking
ThinkingConfigEnabled · object
metadata
Metadata · object | null

Response

Successful Response

id
string
required
model
string
required
content
(TextBlock · object | ImageBlock · object | DocumentBlock · object | ToolUseBlock · object | ToolResultBlock · object)[]
required
stop_reason
enum<string>
required
Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
content_filter
usage
Usage · object
required
type
string
default:message
Allowed value: "message"
role
string
default:assistant
Allowed value: "assistant"
stop_sequence
string | null