Home >web3.0 >Introducing the New Anthropic Token Counting API

Introducing the New Anthropic Token Counting API

DDD
DDDOriginal
2024-11-09 03:00:10554browse

Keep a closer eye on your costs when using Claude

Introducing the New Anthropic Token Counting API

Anthropic has quietly rolled out some interesting beta features in recent days, but they've mostly flown under the radar. One of these features was the ability to process PDFs with their models, which can now understand both text and visual content within PDF documents. I may cover this in more detail in a future article.

The other beta feature, which is the focus of this article, is the introduction of token counting. Importantly, you can count the tokens in user messages, PDFs, and images before sending them to Claude. This is great news for anyone who wants to keep a close eye on their token usage costs.

As stated in the official announcement from Anthropic (link here),

“The token counting endpoint accepts the same structured list of inputs for creating a message, including support for system prompts, tools, images, and PDFs. The response contains the total number of input tokens.”

And supports the following models,

“Claude 3.5 SonnetClaude 3.5 HaikuClaude 3 HaikuClaude 3 Opus”

The above is the detailed content of Introducing the New Anthropic Token Counting API. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn