Skip to main content
Version: 1.8.0

Count message tokens

POST 

/v1/messages/count_tokens

Counts a Messages request's input tokens without calling a model. Since 1.8.5. On a route to Anthropic the count is Anthropic's own; otherwise it is DVARA's estimate.

Workspace status, policy, prompt templates, PII, and guardrails run on the request. No model is called, no usage or cost is booked, and the count does not count against a call cap or the unlicensed call band. The rate limit counts it as a request. Same key and scope as /v1/messages.

Request​

Responses​

The input token count