Hero Barua
All articles
Nov 24, 20267 min readAI workflowTokensLLM basicsHow AI counts

What is a token in AI? How ChatGPT and Claude count your words

Tokens decide what AI costs, how much it remembers and how fast it answers. Here is what a token is, why Bangla can need six times more of them, and how to count them yourself.

Every AI tool I use bills me in tokens, limits me in tokens and slows down in tokens. Yet most people I work with have never seen one. This is part 1 of a short series on how AI counts: tokens, prices, context windows, rate limits and the time slots that decide when you can use it again. We start with the smallest piece.

What is a token in AI?

A token is the small piece of text a language model actually reads and writes. It's not a word and not a letter. It sits in between. A token can be a whole word, part of a word, a space plus a word, or a single symbol like a full stop.

Before a model sees your prompt, a program called a tokenizer cuts your text into these pieces and turns each one into a number. The model only ever works with those numbers. When it answers, it produces numbers again, one token at a time, and the tokenizer turns them back into text.

OpenAI gives a rule of thumb for English: one token is about 4 characters, or about three-quarters of a word, so 100 tokens is roughly 75 words. They also say clearly that these are estimates, not exact counts.

Why AI doesn't just use words

A model needs a fixed list of pieces it knows, called its vocabulary. If that list held only whole words, every new name, typo or product code would be unknown. If it held only letters, every sentence would become a very long string, and long strings are slow and expensive to process.

The common fix is byte pair encoding, or BPE. Sennrich, Haddow and Birch adapted it for language models in 2016. The idea is simple:

  1. Start with single characters.
  2. Find the pair of pieces that appears together most often in a large amount of text.
  3. Merge that pair into one new piece and add it to the vocabulary.
  4. Repeat until the vocabulary is the size you want.

Common words end up as one token. Rare words get built from smaller parts. So the model can still read a word it has never seen. It just costs more tokens.

I counted some tokens myself

I wanted real numbers, not only rules of thumb. So I ran a few lines from my own work through tiktoken, OpenAI's open-source tokenizer (version 0.14.0, 24 November 2026). I used two of its encodings: cl100k_base, which the library maps to GPT-4, and o200k_base, which it maps to GPT-4o and newer models.

  • "Please send me the invoice for last month by Friday. Thank you." 12 words, 14 tokens in both encodings. Almost one token per word, plus the two full stops.
  • The same sentence in Bangla (অনুগ্রহ করে শুক্রবারের মধ্যে আমাকে গত মাসের ইনভয়েসটি পাঠান। ধন্যবাদ।): 87 tokens with the older encoding and 24 tokens with the newer one.
  • A one-line PHP function (88 characters): 20 tokens. Code splits on symbols like (, $ and _.
  • A small JSON object with an invoice number and amount (69 characters): 24 tokens. Quotes, colons and numbers each take their own pieces.
  • The number 1234567890: 4 tokens, split as 123, 456, 789, 0.

Single words show the same pattern. invoice is 1 token. INVOICE in capitals is 2. unbelievable is 3 (un, bel, ievable). My city, Chittagong, is 4. Capital letters, rare names and long numbers all cost more than everyday lowercase words.

Bangla and other languages pay more

That Bangla result is the one that matters most for many of my readers. With the GPT-4 encoding, the same message cost more than six times the tokens of the English version. The newer encoding cut the gap to under two times, which is a big improvement. It's still a gap.

Research backs this up. A NeurIPS 2023 paper from Oxford, Language Model Tokenizers Introduce Unfairness Between Languages, tested 17 tokenizers and found the same text can need up to 15 times more tokens in some languages than in others, even with tokenizers built for many languages. The authors point out what that means in practice: people writing in those languages pay more, wait longer and fit less into the model's memory.

So if you build a product for Bangla speakers, test your real prompts in Bangla. Don't plan your costs on English numbers.

Different models count differently

Each model family has its own tokenizer, so the same text gives different counts. You saw it above: 87 versus 24 for the same sentence. OpenAI's help page says it directly: the same text can produce different token counts depending on the model, its encoding and the language.

That means a token count is only true for one model. When you switch models, count again.

Tokens you don't see

Your visible prompt isn't the whole bill. A real request also carries the system prompt, the earlier messages in the chat, tool definitions, images and files. All of it is tokens.

Models that "think" before answering add more. OpenAI says reasoning tokens aren't shown as answer text, but they count toward output usage and are billed as output tokens. Anthropic's Claude docs say the same about extended thinking: thinking tokens are billed as output, once, when they're generated.

That's why a short question can still produce a large bill.

How to count tokens yourself

  • OpenAI models: use the tiktoken library in Python. Pick the encoding for your model with tiktoken.encoding_for_model("gpt-4o"), then len(enc.encode(text)).
  • Claude models: Anthropic offers a token counting endpoint, /v1/messages/count_tokens. You send the same body you'd send to create a message, including system prompt, tools, images and PDFs, and it returns the input token count. It's free to use, with its own requests-per-minute limit that doesn't touch your normal message limit. The docs call the result an estimate that can differ by a small amount, and they note you aren't billed for tokens the system adds.
  • After a call: every API response reports the real input and output tokens in its usage field. That's the number you're billed on. Log it.

The AI writing helper on this site does exactly that. Every call saves the user, the feature, the model and the input and output tokens, and the whole helper stops at a monthly token cap. When a bill looks wrong, I can see which feature spent the tokens.

Why this matters for your budget

Tokens are also the unit of price, and output usually costs more than input. On Anthropic's current price list, Claude Opus 5.5 costs $4 per million input tokens and $20 per million output tokens: five times more for every token it writes than for every token it reads. Long answers cost far more than long questions.

Part 2 of this series works through a real bill: input, output, thinking and cached tokens, step by step.

Quick summary

  • A token is a piece of text, usually smaller than a word. Models read, write, bill and limit in tokens.
  • In English, 100 tokens is about 75 words. That's a rough guide only.
  • Names, capitals, numbers, code and non-English text all use more tokens.
  • Bangla used 6x the tokens of English on the GPT-4 tokenizer in my test, and under 2x on the newer one.
  • Count with the right tool for your model, and log the real usage from every API response.

References

  1. Understanding and counting tokens, OpenAI Help Center, accessed 24 November 2026.
  2. Neural Machine Translation of Rare Words with Subword Units, Rico Sennrich, Barry Haddow, Alexandra Birch, ACL 2016.
  3. tiktoken: a fast BPE tokeniser for use with OpenAI's models, OpenAI on GitHub, version 0.14.0.
  4. Language Model Tokenizers Introduce Unfairness Between Languages, Aleksandar Petrov et al., University of Oxford, NeurIPS 2023.
  5. Token counting, Claude Platform Docs, Anthropic, accessed 24 November 2026.
  6. Context windows, Claude Platform Docs, Anthropic, accessed 24 November 2026.
  7. Pricing, Claude Platform Docs, Anthropic, accessed 24 November 2026.

Questions people ask

What is a token in AI?

A token is a small piece of text, often part of a word, that a language model reads and writes. Models turn each token into a number, and they bill and limit usage in tokens.

How many words is 1,000 tokens?

In English, about 750 words, using OpenAI's rule of thumb that 100 tokens is roughly 75 words. Code, numbers and other languages use more tokens per word.

Why does Bangla use more tokens than English?

Tokenizers learn their pieces mostly from English-heavy text, so Bangla words get split into more pieces. In my test the same sentence was 14 tokens in English and 24 to 87 in Bangla, depending on the tokenizer.

How do I count tokens before sending a prompt?

For OpenAI models use the tiktoken library. For Claude models use Anthropic's free /v1/messages/count_tokens endpoint. After each call, the API response reports the exact tokens you were billed for.

How useful was this article?

Tap a star

Written by Hero Barua

Full-stack SaaS engineer, 12+ years and Top Rated Plus on Upwork. AI builds the structure; I give it life.

Work with me