Skip to main content
POST
Count input tokens for an Anthropic-compatible request

Authorizations

Authorization
string
header
required

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

Body

application/json

Validates POST /v1/messages/count_tokens (Anthropic-compat) per ADR-YGE00M.

Accepts the same request body shape as /v1/messages (minus stream and max_tokens, which don't affect token counting) so a client can count tokens for the exact same payload it's about to send for a real call.

model
string
required
Maximum string length: 100
messages
object[]
required
Minimum array length: 1
tool_choice
string | null
stop_sequences
string[] | null
system
object[]
tools
object[] | null

Response

input_tokens
integer
required