Claude Messages Count Tokens API
POSThttps://api.acedata.cloud/v1/messages/count_tokens
POSThttps://api.acedata.cloud/claude/messages/count_tokens

Claude Count Tokens API calculates the number of input tokens.

Request Headers

authorizationstring
Bearer token

Request Body

modelstringRequired parameter
A model used for counting token numbers.
toolsarray
List of tool definitions that can be called by the model.
systemstring | array
messagesarrayRequired parameter
thinkingobject
tool_choiceobject
cache_controlobject
ttlstring
Please select
typestringRequired parameter

Response

Integration guide

Shell

Python

JavaScript

Java

Go

PHP

Kind reminder: For streaming requests, the above code may not be fully applicable. Please refer to the integration documentation for changes.

Claude AI
Allow Use General Balance

When 'Allow General Balance' is enabled, the general balance is used automatically if an app's balance is insufficient.