Skip to main content
POST
Count Anthropic Messages input tokens

Headers

Authorization
string | null

Bearer API key.

x-api-key
string | null

API key alternative for Anthropic-compatible clients. Authorization takes precedence when both headers are present.

Body

application/json

Anthropic Messages count-tokens-compatible request.

model
string
required
Minimum string length: 1
messages
AnthropicMessage · object[]
required
Minimum array length: 1
system
tools
Tools · object[] | null
tool_choice
AnthropicToolChoice · object | null
thinking
AnthropicThinking · object | null
output_config
AnthropicOutputConfig · object | null
context_management
AnthropicContextManagement · object | null

Supported beta context-management subset.

keep=all does not remove any replayed thinking blocks, so it can be safely consumed at the compatibility boundary and omitted from the vLLM provider payload.

Response

Successful Response

input_tokens
integer
required
Required range: x >= 0
Last modified on August 11, 2026