Application Process
To use Claude Messages Count Tokens API, first open the Ace Data Cloud Console and copy your API Token.
If you are not logged in, you will be redirected to sign in and brought back to this page automatically.
A single API Token works across every service on the platform — no need to subscribe per service. New accounts receive free starter credit; when it runs low you can top up your shared balance in the console.
📘 Full documentation: Claude Messages Count Tokens API →
Basic Usage
The request path for the Claude Messages Count Tokens API is/v1/messages/count_tokens, consistent with the official Anthropic API. We need to provide at least two required parameters:
model: Choose the Claude model to use, such asclaude-sonnet-4-5-20250929,claude-opus-4-20250514, etc.messages: An array of input messages, each containingroleandcontent.
system: System prompt, which will be included in the token count.tools: Tool definitions, which will be included in the token count.thinking: Extended thinking configuration.
cURL Example
Python Example
Using Anthropic SDK
The Claude Messages Count Tokens API is fully compatible with the official Anthropic SDK and can be called directly using theanthropic library.
Token Count Including Tools
If your request includes tool definitions, these tools will also be included in the token count:Token Count Including System Prompts
System prompts will also be included in the token count:Notes
- This API only calculates the input token count and does not produce any model output.
- The token count result can be used to estimate the cost of calling the Claude Messages API.
- The tokenization method may vary for different models, so please use the same model parameter as in the actual call.
- This API is completely free and does not consume any quota.

