### Install Anthropic Tokenizer Source: https://github.com/anthropics/anthropic-tokenizer-typescript/blob/main/README.md Installs the Anthropic tokenizer package using either npm or yarn. This is the first step to using the tokenizer in your project. ```sh npm install --save @anthropic-ai/tokenizer # or yarn add @anthropic-ai/tokenizer ``` -------------------------------- ### Count Tokens with Anthropic Tokenizer (JavaScript) Source: https://github.com/anthropics/anthropic-tokenizer-typescript/blob/main/README.md Demonstrates how to use the `countTokens` function from the `@anthropic-ai/tokenizer` package to count tokens in a given text string. This example logs the text and its corresponding token count to the console. ```javascript import { countTokens } from '@anthropic-ai/tokenizer'; function main() { const text = 'hello world!'; const tokens = countTokens(text); console.log(`'${text}' is ${tokens} tokens`); } main(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.