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
System prompt.
messagesarrayRequired parameter
Input message list.
thinkingobject
Configuration for enabling the extended thinking feature of Claude.
typestring
Please select
budget_tokensinteger
Specify the maximum number of tokens that Claude can use in the internal reasoning process.
tool_choiceobject
How to use the provided tools for the control model.

Response

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.

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.