messages
Count Message Tokens
Anthropic /v1/messages/count_tokens-compatible endpoint.
Returns {"input_tokens": N} without contacting an upstream provider: counting is local, so there is no budget reservation, pricing, or usage logging. Authentication mirrors :func:create_message — hybrid mode resolves the caller's token against the platform, standalone mode validates the API key — so the endpoint is not an open token-counting oracle.
post/v1/messages/count_tokens
Request body
Response
Successful Response