Skip to main content
POST
Anthropic Messages Count Tokens

Authorizations

Authorization
string
header
required

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

Headers

x-deepinfra-service-tier
string | null

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-key
string | null
x-api-key
string | null

Body

application/json
model
string
required
messages
Messages · object[]
required
system
tools
AnthropicTool · 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.

tool_choice
Tool Choice · object | null

Response

Successful Response