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
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
router_candidates
string[] | null

List of model candidates for dynamic routing when using 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 >= 1
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.