WhatsApp
Chat on WhatsApp

AI Tokens Explained: What They Cost Your Business

When you work with a language model, the amount of text matters. A model will happily edit a short paragraph, but it can't always read an entire book in a single request. The reason is that language models don't read words and characters the way people do. They work with tokens, and there is a limit to how many tokens they can process at once.

The number of tokens decides more than how much information a model can "keep in mind". It also decides how much you pay. When you connect AI to your website, a WhatsApp bot or your CRM through an API, the monthly bill is calculated in tokens. Businesses that don't understand how this works usually find out when the first invoice arrives.

In this guide, we explain:

  • what a token is and how a language model builds an answer one token at a time;
  • how a tokenizer splits text, and why many languages need more tokens than English;
  • how models process images, audio and video;
  • what a context window is and what happens when it fills up;
  • how to count tokens and calculate the cost of a request;
  • how to cut token usage without hurting the quality of the answers.

What a token is in a language model

A token is the basic unit of information a language model works with. In text, a token can be a whole word, part of a word, a punctuation mark, a space or a few characters together.

A short, common word usually fits into a single token. A long or rare word, or a word in a language the model knows less well, is split into several tokens. Exactly how the text is divided depends on the tokenizer, a dedicated piece of software that does the splitting before the text ever reaches the model itself.

Four glass cubes floating in a row, each a different colour: purple, light blue, pink and orange, on a dark purple background
A single word can become one token or several, depending on the tokenizer. Illustration: RJL Studio

How the model builds an answer

Once the text is split, each token gets an identification number (ID). Using that ID, the model looks up a numerical representation of the token, called an embedding. These representations let the model run calculations and understand the order of the tokens and the relationships between them.

The model doesn't write the whole answer at once. At every step, it estimates which tokens could continue the text, assigns each option a probability and picks the next one. Say the model needs to continue the sentence "Tomorrow we are". There are many options: "leaving", "meeting", "starting". If your previous message was about a holiday, it will most likely write "Tomorrow we are leaving for the beach".

The chosen token is added to the sequence, and the process repeats. The model doesn't always pick the most likely option. With certain settings, it chooses with controlled randomness based on the probabilities, which is why the same question can get different answers.

Generation ends when the model produces an end token or reaches the length limit that was set. In services that use streaming, you see the answer appear gradually, token by token.

How a tokenizer splits text

Before the model starts working, the tokenizer breaks the text into pieces. Two different tokenizers can split the same sentence differently, because each one has its own vocabulary and rules. In a typical split, the space before a word is usually included in that word's token, and punctuation marks become separate tokens.

The BPE algorithm

One of the most common algorithms is BPE (Byte Pair Encoding). To train it, you use a huge collection of text: books, articles, websites. The algorithm looks for combinations that appear often and gradually merges them into larger tokens.

A simple example: suppose the training text contains three words: "low" a hundred times, "lot" eighty times and "old" twenty times. At first, every letter is a separate token. The algorithm counts which pair of neighbouring letters appears most often. The pair "l" and "o" appears 180 times (in "low" and "lot"), so it becomes a new token: "lo". In the next round, "lo" plus "w" appears a hundred times and "lo" plus "t" eighty times, so a new token is created that matches a whole word: "low".

The process repeats until the vocabulary reaches a size set in advance. On new text, the tokenizer simply applies the rules it has learned.

Most modern models use a version of BPE that works on bytes rather than letters. Inside a computer, every character is stored as a number. In UTF-8 encoding, a basic Latin letter takes one byte, while accented letters and Greek or Cyrillic characters take two. When text is split by bytes, a token boundary can even fall in the middle of a character. This is one of the reasons the number of tokens doesn't equal the number of words or characters.

The WordPiece and Unigram algorithms

Besides BPE, there are two other common algorithms. WordPiece looks in its vocabulary for the longest piece that matches the start of a word, then repeats the search for whatever is left. If the word "unhappy" isn't in the vocabulary as a whole, but "un" and "happy" are, it splits the word into those two tokens. If no piece matches, the basic version replaces the word with a special "unknown word" token.

Unigram works differently. Instead of always picking the longest piece, it considers several possible ways to split a word and chooses the most likely one, based on probabilities learned during training.

A 3D glass machine with a continuous ribbon of light flowing into it and small cubes coming out the other side in a row on a conveyor belt
The tokenizer turns continuous text into a chain of small pieces the model can process. Illustration: RJL Studio

What affects the number of tokens in a text

There is a well-known rule of thumb: one token is roughly four characters of English text. It is a rough estimate that works mainly for English. In practice, the number of tokens depends on several factors.

The type of tokenizer

Every provider, and sometimes every generation of models, has a different tokenizer. A sentence that takes eight tokens in one model can take ten in another. The more words and combinations in the vocabulary that match your text, the fewer tokens you need. That is why usage and cost can change when you switch models, even if the text stays exactly the same.

Language: why English is usually the cheapest

For businesses that serve customers in several languages, this is the most important point. Many tokenizers were built on training data that is mostly English. Common English words take a single token, while words in other languages are often split into several pieces. The structure of the language matters too. Languages with rich inflection, such as Greek, Portuguese or Russian, have many forms of the same word, and languages like German build long compound words. What English expresses as three short words can become one long word that the tokenizer breaks apart.

The result: the same content in another language usually uses more tokens than in English. The ratio depends on the tokenizer, and the gap is smaller in newer models, because their vocabularies are built better for other languages. Either way, when you plan the budget for a bot that answers customers in Greek, Portuguese or any language other than English, don't rely on calculators built around English. Test with your own real texts.

Spelling, spaces and special characters

Small changes in writing matter too. In English, the same word with a capital or lowercase letter, or with or without a space before it, can become different tokens.

Numbers, punctuation, line breaks, emoji and code all have an effect. A formatted table with lots of spaces and separator characters can use more tokens than the same information as a simple list. HTML full of tags "weighs" far more than the same text in plain form.

So you can't know the exact number of tokens from the word or character count alone. If you need to check whether a text will fit into the context window, or how much a request will cost, use the token counter for that specific model.

How models process images, audio and video

Multimodal models also convert images, sound and video into tokens, using methods that depend on the type of data.

Images

Many models divide an image into small squares called patches. If you upload a photo of a bicycle, some patches will contain parts of the wheels, others the frame and others the background. The boundaries don't follow the objects: a single patch can contain the edge of a wheel and some grass.

Each patch becomes a visual token with information about its position. A larger image needs more tokens, so models sometimes shrink the image before processing it. The trade-off: small details, such as fine print on a scanned document, can disappear. If you send receipts or invoices to a model to extract data, it is worth checking the resolution they arrive in.

Video

With video, the model has to understand both the content of each frame and the changes between frames. A common approach is to split the video into frames, split each frame into patches and turn them into visual tokens that include both the position in the frame and the position in time. This lets the model follow movement across the video.

Audio

To process sound, models convert the recording into numerical data. One way is a spectrogram, a chart that shows which frequencies are present in the sound and how their intensity changes over time.

Another approach is to transcribe the speech into text first and only then send it to a language model. A transcript is enough to answer a question like "When will my order arrive?". But if it matters to detect the customer's tone or music in the background, a transcript alone won't do. For voice bots and call centre analytics, this difference affects both quality and cost.

What a context window is

Every language model has a limit on how many tokens it can take into account when preparing an answer. That limit is called the context window. It determines how much information the model can process in one request.

When you send a message, the model receives more than that message. It also receives the conversation history, attached files, search results and system instructions the application adds behind the scenes. All of these take up space in the window.

The tokens the model receives are called input tokens, and the ones it generates are called output tokens. In most models, both count towards the context window.

An example: the context window is 32,000 tokens. Your request, the history and the attached document together take 26,000. That leaves 6,000 tokens for the answer. But this doesn't mean the model will write a 6,000-token answer. There is usually a separate limit on output length as well. If that limit is 4,000, the model won't go beyond it even if there is free space in the window.

In models that think before they answer (reasoning models), part of the output tokens goes on internal reasoning. These tokens don't appear in the final answer, but they count towards the output limit and usually towards the bill as well.

A large glass frame almost completely filled with colourful cubes, a few cubes falling in from above and a small white figure looking on from the side
The context window fills up with instructions, history and files, and whatever is left goes to the answer. Illustration: RJL Studio

Files and the context window

When you upload a file, token usage depends on how the application processes it. With a PDF, the service might extract the text, turn every page into an image or send the model only the relevant sections. So you can't estimate the number of tokens from the file size or page count alone.

What happens when the window fills up

It depends on the model and the application. Some services reject a request that is too large. Others shorten the history automatically: they delete old messages or replace them with a short summary. Tools like Claude and ChatGPT manage long conversations this way.

What this means in practice: you may see the whole conversation on your screen, but the model is only receiving part of it. That is why, in long conversations, it sometimes starts to "forget" requirements stated at the beginning. In a customer service bot, this is a real problem, and important instructions belong in the system prompt, not just in the first message.

How to count tokens and calculate costs

Tools for counting before you send

To see how many tokens a text takes, you can use the OpenAI Tokenizer or a similar tool from your chosen provider. Paste in some text, and the tool shows how many tokens it contains and how it was split. It works for code as well. Keep in mind that the result only covers the snippet you pasted: history, images and files have to be calculated separately.

The OpenAI and Anthropic APIs also offer ways to count input tokens before sending a request, including images, files and system instructions.

The usage field in the API response

After each request, the API usually returns not only the answer but also consumption data in a usage field: how many input tokens, how many output tokens and, for reasoning models, how many of them went on reasoning. Reasoning tokens are usually already included in the output count, so don't add them twice.

To calculate costs, rely on the usage data rather than your own counting. When we build a bot or an automation for a business, we store this data for every request. That way you can see exactly what an average conversation costs and where the money goes.

The cost formula

With an API, you pay for the number of tokens processed. Input and output have separate rates, and output is almost always more expensive. Prices are quoted per million tokens, but you only pay for what you use. The formula:

Cost = (input tokens × input price + output tokens × output price) ÷ 1,000,000

An example with purely illustrative numbers: suppose a million input tokens cost €1 and a million output tokens cost €5. A bot received a customer's question along with system instructions, 1,000 input tokens in total, and wrote a 500-token answer. The calculation: (1,000 × 1 + 500 × 5) ÷ 1,000,000 = €0.0035. A single conversation is very cheap, but with a thousand conversations a day and a history that keeps growing, the total adds up.

Prices change often and depend on the model, so always check the official pricing pages of OpenAI, Anthropic and Google before you plan a budget.

A 3D glass balance scale with a pile of glowing cubes on one pan and smooth, unmarked glossy orange coins on the other
With an API, you pay for every input and output token, and output usually costs more. Illustration: RJL Studio

What else affects the bill

  • Extra tools: web search, code execution or file storage are sometimes priced separately;
  • Caching: input that repeats can cost less;
  • Batch processing: providers offer a discount on requests that don't need an immediate answer;
  • Model choice: a small, fast model is far cheaper than the flagship, and for simple tasks it is good enough.

With ChatGPT, Claude or Gemini subscriptions, you pay a fixed monthly fee and don't count tokens per message, but there is still a context window and usage limits.

How to use fewer tokens without losing quality

The more text a model receives and generates, the more tokens it uses. But cutting at any cost is a bad idea: if the model is missing information, it will do the task wrong, and the corrections will cost even more tokens. Here is what actually works.

Define the task clearly

Write what needs to be done, which data to use and what the result should look like. Remove details that don't matter, keep the conditions that do. Instead of a long description of your whole business and a general request to "help with an email", write: "Write an 80-word email to a customer who hasn't paid an invoice, in a polite, matter-of-fact tone, with a payment link at the end". We cover how to write good requests in detail in our guide to writing AI prompts.

Limit the length of the answer

If you need a short explanation, three examples or a list, say so. Instead of "What is an API?", write "Explain what an API is in three sentences and give one example". With an API, where every output token costs money, this saves money directly. You can also set an output length limit in the request parameters.

Send only the relevant parts

There is no need to send a hundred-page document if two clauses are enough. If you want to check the cancellation terms in a contract, send the relevant clause and whatever relates to it. In a bot that answers product questions, don't load the entire catalogue with every request. This is exactly the problem RAG solves: the system retrieves only the passages relevant to the question. We explain how it works in our guide to RAG.

Trim the conversation history

With an API, previous messages are usually sent along with every new request, so a long conversation inflates input tokens. Instead of sending the whole dialogue, you can keep a short summary: "Customer is interested in a company website package, budget in the mid range, asked for a meeting on Tuesday". The summary must keep decisions, requirements and everything needed to continue.

Use caching for repeated parts

Some APIs let you reuse input that has already been processed, at a reduced price. This is especially useful when the same instructions or the same document repeat in every request. For example, a system that analyses hundreds of customer reviews every day using the same rules. For caching to work, the fixed part must come at the start of the request and be worded exactly the same each time. Caching doesn't reduce the number of tokens, but it lowers their price.

Match the model to the task

Not every task needs the most powerful model. Classifying enquiries, extracting a name and phone number from a message or a short translation will work perfectly well on a small, cheap model. Save the large model for complex analysis, long-form writing and decisions that require multi-step reasoning. In the systems we build, this kind of routing is usually the single biggest saving.

Glowing glass cubes passing through a glossy funnel and coming out in a smaller quantity, next to a small purple wallet with an orange sparkle
Clear instructions, focused context and the right model choice reduce token usage. Illustration: RJL Studio

Tokens in a business project: what to check before you launch

When a business connects AI to its website, WhatsApp or an internal system, tokens turn from a technical question into a budget question. Here is a short working plan.

A five-step plan

1. Define the task and the volume. How many requests a month, in which languages, and what the average length of a question and an answer is.

2. Measure on real data. Take twenty real conversations in the languages your customers use, run them through the token counter of the model you chose and calculate an average.

3. Calculate the monthly cost. Multiply the average by the number of requests and the rate, then add a margin for long conversations and retries.

4. Set limits. A monthly spending cap in your provider account, an output length limit and a limit on how much history is sent.

5. Monitor from day one. Store the usage data for every request, so you spot anomalies before they reach the invoice.

If your conversations contain customers' personal data, also check how the provider stores and processes it, and how that fits your GDPR obligations. This is general information, not legal advice.

To understand the full financial picture, including development, maintenance and return on investment, read our guide to AI project costs.

Common mistakes

  • Budgeting with an English-only calculator. In most other languages, usage is higher, and a budget based on English text will turn out too low.
  • Sending the whole history with every request. In a bot that handles long conversations, this can double or triple the cost without anyone noticing.
  • Using the flagship model for every task. You pay a premium for simple classification that a small model would handle just as well.
  • No spending cap. A bug in a loop, or someone trying to abuse your bot, can generate thousands of requests in a single night.
  • Over-trimming the instructions. A system prompt that is too short leads to mistakes, and fixing them costs more than you saved.

How RJL Studio helps businesses use AI wisely

We build AI integrations for businesses and plan the running cost at the specification stage, not after the first invoice. What we do:

  • smart bots and assistants for websites and WhatsApp, in English, Russian and other languages your customers use;
  • automation and integrations with n8n, Make and Zapier, including connections to your CRM and existing systems;
  • choosing a model for each task, plus caching and RAG to keep token usage under control;
  • monitoring usage data and spending caps, so costs stay predictable.

If you are considering a bot or an automation, a good place to start is our guide to chatbots for business. Want to know what it would cost in your case? Get in touch and we will come back to you for a short introductory call.

Frequently asked questions

What is a token in simple terms?

A token is a small piece of text that a language model works with: a whole word, part of a word, a punctuation mark or a space. The model reads your request as a sequence of tokens and writes its answer one token at a time. Images, audio and video are also converted into tokens, using different methods.

How many words are in one token?

There is no fixed ratio. For English, a common estimate is that one token is about four characters, which is less than a word. In most other languages, usage is usually higher, and the ratio depends on the model's tokenizer. To know for sure, test your text in the token counter of the model you are working with.

Why do some languages use more tokens than English?

Many tokenizers were trained mostly on English text, so English words are split into fewer pieces. On top of that, many languages have rich inflection, with lots of forms of the same word, or build long compound words. The gap is smaller in newer models, but in most cases it still exists.

What is the difference between the context window and the output limit?

The context window is the total number of tokens the model can take into account in a single request: instructions, history, files and the answer. The output limit is a separate cap on the length of the answer alone. Even if there is plenty of room left in the window, the model won't write an answer longer than that limit.

How can I lower the API cost of a business chatbot?

Send only the relevant information (for example, using RAG), summarise long histories, limit the length of answers and use caching for instructions that repeat. Move simple tasks to a small, cheap model. And set a spending cap and monitor usage data, so you catch anomalies early.

Disclaimer: blog content is for general information and learning only and is accurate as of its publication date. It is not professional, legal, financial or business advice, nor a recommendation or call to take any action. Any use of this information is at the reader's own risk, and we accept no liability for any resulting loss. Links to external websites and tools are provided for convenience only. We recommend consulting a qualified professional before making decisions.