Skip to main content
POST
/
v3
/
v1
/
messages
Create Anthropic Message
curl --request POST \
  --url https://api.edenai.run/v3/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "messages": [
    {
      "role": "user",
      "content": "<string>"
    }
  ],
  "fallbacks": [
    "<string>"
  ],
  "router_candidates": [
    "<string>"
  ],
  "max_tokens": 1024,
  "system": "<string>",
  "temperature": 1,
  "top_p": 0.5,
  "top_k": 123,
  "stream": false,
  "stop_sequences": [
    "<string>"
  ],
  "tools": [
    {}
  ],
  "tool_choice": {},
  "metadata": {},
  "thinking": {},
  "extra_headers": {}
}
'
{
  "id": "<string>",
  "model": "<string>",
  "content": [
    {
      "type": "<string>",
      "text": "<string>",
      "id": "<string>",
      "name": "<string>",
      "input": {},
      "tool_use_id": "<string>",
      "content": "<string>",
      "is_error": true,
      "source": {},
      "thinking": "<string>",
      "signature": "<string>"
    }
  ],
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "cache_creation_input_tokens": 123,
    "cache_read_input_tokens": 123
  },
  "type": "message",
  "role": "assistant",
  "stop_reason": "end_turn",
  "stop_sequence": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://www.edenai.co/docs/llms.txt

Use this file to discover all available pages before exploring further.

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
metadata
Metadata · object
thinking
Thinking · object
extra_headers
Extra Headers · object

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.