QUICK ANSWER
LLM Token Counter
An LLM token counter must use the tokenizer associated with the model being measured. The same text can produce different counts under different tokenizers, so there is no single exact token total for every language model. For billing, the provider’s recorded input and output usage is authoritative.
Why LLM token counts differ
A tokenizer converts text into model vocabulary units. Vocabulary, normalization rules, and encoding differ between model families and can change between model generations. Words, punctuation, code, whitespace, emoji, and non-English text may therefore split differently.
How to get the right count
Select the exact model first, then use the tokenizer or token-counting method documented for that model. When a provider supplies a tokenizer library or returns usage information through its API, prefer that model-specific result over a character- or word-based estimate.
Prompt text is not always the whole request
API requests may include system instructions, message formatting, tool definitions, schemas, files, images, or other provider-managed content. A counter that sees only pasted text cannot confirm the complete billed usage for such a request.
Count and cost are separate steps
Use the OpenAI Token Counter for text measured with an OpenAI encoding. Use the Token Cost Kit homepage to apply model rates after you have a token total. Read Counter Token if you need to distinguish AI tokens from other meanings of the phrase.