Skip to main content
POST
Create Anthropic Message

Authorizations

Authorization
string
header
required

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

Body

application/json
model
string
required
messages
AnthropicMessage · object[]
required
routing
ProviderRoutingPreferences · object | null

How to pick between the providers that serve the requested model. Applies only when model is a model name with no provider prefix (e.g. 'gpt-5.5'); ignored for a concrete 'provider/model' id, which already names its provider. This does not choose the model — for that see router_candidates with model='@edenai'.

fallbacks
string[] | null

List of fallback model IDs to try if the primary model fails. Models are tried in order. Example: ['anthropic/claude-3-opus', 'openai/gpt-4o']

Maximum array length: 3
session_id
string | null

Identifies a conversation, so its requests keep reaching the provider that holds its prompt cache. Any stable string you choose — a thread id, a ticket number, an agent run. Also accepted as the x-session-id header, for clients that cannot add body fields; the body field wins if both are sent. Without one, a conversation is recognised from its opening messages instead.

Maximum string length: 256
router_candidates
string[] | null

Models the '@edenai' router may choose BETWEEN — it picks the model, whereas routing picks the provider for a model you already named. Used only when model='@edenai'. Each entry should be 'provider/model', e.g. ['openai/gpt-4o', 'anthropic/claude-3-5-sonnet-20241022']. If not provided, defaults to all available models.

max_tokens
integer | null
default:1024
Required range: x >= 0
system
temperature
number | null
Required range: 0 <= x <= 2
top_p
number | null
Required range: 0 <= x <= 1
top_k
integer | null
stream
boolean | null
default:false
stop_sequences
string[] | null
tools
Tools · object[] | null
tool_choice
Tool Choice · object | null
metadata
Metadata · object | null
thinking
Thinking · object | null
extra_headers
Extra Headers · object | null

Response

Successful Response

Response body for POST /v1/messages (non-streaming).

id
string
required

Unique identifier for the message.

model
string
required

Model that generated the message.

content
AnthropicContentBlock · object[]
required

Ordered list of content blocks produced by the model.

usage
AnthropicUsage · object
required

Token usage for the request.

type
string
default:message

Object type. Always 'message' for this endpoint.

Allowed value: "message"
role
string
default:assistant

Conversational role of the response.

Allowed value: "assistant"
stop_reason
enum<string> | null

Reason generation stopped, if known.

Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use
stop_sequence
string | null

Custom stop sequence that triggered the stop, if any.