Chat Completions

Anthropic Messages

Changed on
post/anthropic/v1/messages

Request

  • Base URL: https://api.deepinfra.com
  • URL: https://api.deepinfra.com/anthropic/v1/messages
  • Auth: HTTP bearer

Headers

anthropic-versionstring nullable
anthropic-betastring nullable
x-deepinfra-sourcestring nullable
x-deepinfra-service-tierstring nullable

Per-request service tier (priority or flex) for clients that cannot set the service_tier body field. The body field wins when both are present; unrecognized values ride the default tier.

xi-api-keystring nullable
x-api-keystring nullable

Request body

service_tier'default' | 'priority' | 'flex'
fail_fastboolean

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.

modelsstring[] nullable

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.

modelstring required
max_tokensinteger nullable
messagesobject[] required
stop_sequencesstring[] nullable
streamboolean nullable
temperaturenumber nullable
top_pnumber nullable
top_kinteger nullable
metadataobject nullable
tool_choiceobject nullable
prompt_cache_keystring nullable

Response

Successful Response

unknown required

Changes