Anthropic Messages

Create Anthropic Message

Anthropic Messages API, native pass-through.

post/v3/v1/messages

Request

  • Base URL
    https://api.edenai.run
  • Auth
    HTTP bearer

Request body

tagsunknown
fallbacksstring[] nullable

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']

session_idstring nullable

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, and read from the headers coding agents already send (x-claude-code-session-id, x-session-affinity, session-id, session_id, and x-client-request-id from pi and Codex); the body field wins if both are sent. Without one, a conversation is recognised from its opening messages instead.

router_candidatesstring[] nullable

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.

pre_hooksobject[] nullable

List of hooks to run before the LLM provider call. Each entry must have an 'action' key and optional 'params'. Example: [{'action': 'pdf_text_extract', 'params': {'method': 'default'}}]

post_hooksobject[] nullable

List of hooks to run after the LLM provider call. Each entry must have an 'action' key and optional 'params'. Example: [{'action': 'json_heal', 'params': {'json_schema': {...}}}]

modelstring required
max_tokensinteger nullable
temperaturenumber nullable
top_pnumber nullable
top_kinteger nullable
streamboolean nullable
stop_sequencesstring[] nullable
toolsobject[] nullable
tool_choiceobject nullable
metadataobject nullable
thinkingobject nullable
extra_headersobject nullable

Example request

{
  "tags": {
    "client": "acme",
    "project": "invoices"
  }
}

Response

Successful Response

idstring required

Unique identifier for the message.

type'message'

Object type. Always 'message' for this endpoint.

role'assistant'

Conversational role of the response.

modelstring required

Model that generated the message.

stop_reason'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' nullable

Reason generation stopped, if known.

stop_sequencestring nullable

Custom stop sequence that triggered the stop, if any.

Changes

No recorded changes to this operation across all 1 revision of this API.