Skip to main content
POST
Anthropic Messages

Authorizations

Authorization
string
header
required

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

Headers

anthropic-version
string | null
anthropic-beta
string | null
x-deepinfra-source
string | null
x-deepinfra-service-tier
string | null
xi-api-key
string | null
x-api-key
string | null

Body

application/json
model
string
required
messages
Messages · object[]
required
service_tier
enum<string> | null

The service tier used for processing the request. 'priority' processes the request with higher priority (premium rate); 'flex' processes it at lower priority for a discount, served only when spare capacity exists and may be retried/timed out under load. Both apply only to models that support the respective tier. For compatibility, 'auto' is treated as 'priority' and 'standard_only' as 'default'.

Available options:
default,
priority,
flex
fail_fast
boolean
default:false

If true, the request is rejected immediately with HTTP 429 when the model has no spare capacity, instead of waiting in the queue. Opt-in; the default (false) keeps standard queueing behavior.

models
string[] | null

Ordered list of up to 4 fallback models. The request is attempted on each model in order: when a model rejects it for lack of capacity (HTTP 429 model-busy / flex no-capacity), the next model is tried server-side. The first model that accepts serves the request; the response's model field and billing reflect that model, at that model's pricing. Models before the last are attempted without queueing (as if fail_fast were set); the last model honors the request's own fail_fast value. When models is set, the model field is ignored. Entries must be plain model names (no deploy_id:, custom_hostport, or :revision specifiers); duplicate entries are ignored, keeping the first occurrence.

Required array length: 1 - 4 elements
max_tokens
integer | null
system
stop_sequences
string[] | null
stream
boolean | null
default:false
temperature
number | null
default:1
top_p
number | null
top_k
integer | null
metadata
Metadata · object | null
tools
AnthropicTool · object[] | null
tool_choice
Tool Choice · object | null
thinking
AnthropicThinkingConfig · object | null

Anthropic thinking config: {type: enabled|disabled|adaptive, budget_tokens}.

enabled is a legacy pre-spec field this endpoint used to accept; it only applies when type is absent.

prompt_cache_key
string | null

Response

Successful Response