Anthropic
Count message tokens (Anthropic-compatible)
Counts input tokens for an Anthropic-compatible messages request without creating a model response. Authentication is required; the operation is not billed. Verified upstream counting is preferred. Upstream availability failures return a local estimate marked by X-TokenLab-Count-Tokens-Source: local_estimate. Platform authentication, permission and input errors remain errors. Bound files unreadable locally require upstream counting.
post/v1/messages/count_tokens
Request
- Base URL: https://api.tokenlab.sh
- URL: https://api.tokenlab.sh/v1/messages/count_tokens
- Auth: HTTP bearer
Request body
Example request
{
"model": "claude-sonnet-4-6"
}Response
Token count response
Example response
{
"input_tokens": 1234
}Changes
No recorded changes to this operation across all 1 revision of this API.