Anthropic has released some interesting beta features in recent days that have largely gone unnoticed. One of them was the ability to process PDF files with their models, which can now understand both text and visual content within PDF documents. Maybe I'll write something about that at a later date.
The other interesting beta feature, and the topic of this article, was the introduction of token counting. Fundamentally, you can count tokens in user messages, PDF files, and images. before You send them to Claude. This is excellent news for those who like to closely monitor the usage costs of their tokens.
According to Anthropic's official announcement (link here),
“The token counting endpoint accepts the same structured list of inputs to create a message, including support for system prompts, tools, images, and PDF files. The response contains the total number of input tokens.”
And it is compatible with the following models,
“Sonnet of Claudius 3.5
Claude 3.5 Haiku
Claude 3 Haiku
Close 3 Job”