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 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. With model='@edenai' the platform chooses the model too: quality_cost steers that choice, and the provider fields apply whenever the chosen model is a provider-less name.

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 is a bare model name (e.g. 'gpt-5.5' — the winner's provider is then picked like any provider-less request) or a 'provider/model' id (e.g. 'openai/gpt-5-nano' — the winner is served by that exact provider). Entries the router cannot rank are skipped and listed under edenai_metadata.routing.auto.dropped; entries naming a model already in the list collapse into its earliest spelling, which decides how the winner is returned. The request fails only when no entry is left. If not provided, the router chooses from a default pool of eligible catalog models. At most 64 entries of up to 128 characters each.

Maximum array length: 64
Maximum string length: 128
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.