A token is the unit an AI model reads and writes text in: a short word, a piece of a longer word, a punctuation mark or a space. Models are billed per million tokens and cap how many tokens fit in one request, so tokens set both your API bill and how much text the model can hold at once.
A token in AI is the smallest piece of text a language model handles. Your text is encoded into a sequence of tokens before the model sees it, and the model writes its answer one token at a time. Anthropic's glossary puts it plainly: tokens are the smallest individual units of a language model, and can correspond to words, subwords, characters or even bytes.
Each model family ships its own tokenizer, so one sentence is a different number of tokens on different models. Every price and limit below comes from a page I read on 14 November 2026.
In words: count the characters, convert them to a token estimate, separate input from output and cached tokens because each carries its own price, check the total against the context window, then multiply calls by tokens by price.
How does an AI model turn your text into tokens?
It splits the text into pieces from a fixed vocabulary, then replaces each piece with a number. Google's Understand and count tokens page gives the mechanics: tokens can be single characters like z or whole words like cat, long words are broken into several tokens, the set of all tokens a model uses is its vocabulary, and the splitting is tokenization.
So common words usually survive as one token, while rare words, product names and identifiers get chopped into several. The Anthropic glossary explains the trade: larger tokens are more efficient and are used when possible, while smaller tokens let a model handle uncommon or never-before-seen words. Take one sentence:
Tokens are how a model reads your text and how your bill is counted.
That is 14 words and exactly 68 characters, spaces and full stop included. At the 4-characters-per-token rule Google publishes for Gemini models, it is about 17 tokens; at the 3.5 English characters Anthropic documents for its earlier tokenizer, about 19. The model never sees letters, only that sequence of numbers.
Spaces and punctuation count, and so does structure you did not type: OpenAI's Counting tokens guide says the count includes formatting tokens for message roles and boundaries, which appear in no field you can tokenize yourself.
How do you estimate the token count of your own text?
Count the characters in any editor, then divide by the ratio the provider publishes. Each provider frames that ratio differently, and one of them warns against it, which is the first reason two estimates disagree.
| Provider | What its docs say (read 14 November 2026) | Exact count |
|---|---|---|
| Google, Gemini models | A token is about 4 characters, and 100 tokens is about 60 to 80 English words | count_tokens before sending, usage on the response |
| Anthropic, Claude models | Characters per token depend on the model and the language; about 3.5 English characters before Claude 4.7, whose newer tokenizer produces roughly 30 percent more | The token counting API, then usage on the response |
| OpenAI | Warns that a characters / 4 estimate is inaccurate for images and files, and that tools and schemas add tokens | The input token count endpoint, same payload as a real request |
For plain English prose that gives a planning range, not a quote.
| What you are sending | Characters | Tokens at 4 per token | Tokens at 3.5 per token |
|---|---|---|---|
| A short support reply | 500 | 125 | 143 |
| A long product page | 7,000 | 1,750 | 2,000 |
| A 40-page PDF of text | 100,000 | 25,000 | 28,600 |
For a number you can put in a quote, use the counting endpoint, which takes the same payload as a real call. The OpenAI guide gives the reasons: images and files cannot be estimated from characters, and tool schemas add tokens.
Why do two models count the same text differently?
Because the tokenizer is part of the model, not part of the text. Anthropic's pricing page is the clearest published example: Claude 4.7 and later use a newer tokenizer that produces approximately 30 percent more tokens for the same text, with the exact increase depending on the content. Same paragraph, same company, about a third more tokens, because the vocabulary changed.
Language matters for the same reason. Both rules above are stated for English, and the Anthropic glossary says the characters a token represents depend on the model and the language. A vocabulary fitted mostly to English splits another script into smaller, more numerous pieces, and code and JSON behave the same way. So a price per million tokens is only comparable if two models turn your text into the same number of tokens, and they do not. Run your own sample through both counting endpoints before deciding one is cheaper.
What is the difference between input, output and cached tokens?
They are separate meters on the same bill. Input is everything you send, output is everything the model writes, and cached input is text the provider has already processed and can reuse at a discount.
| Token type | What it covers | How it is priced |
|---|---|---|
| Input | System prompt, every message, retrieved passages, images, documents and tool definitions | The base input rate per million tokens |
| Output | The reply, plus any reasoning or extended thinking | Five times the base input rate on every Claude model, and on the gpt-6 short-context rates used below |
| Cache write | Storing a prompt prefix the first time | Anthropic: 1.25x the input rate for a five-minute cache, 2x for one hour |
| Cache read | Reusing that prefix on a later call | Anthropic: 0.1x the input rate on most models, 0.05x on Claude Sonnet 5.5 and Opus 5.5. OpenAI: cached input, discounted up to 95 percent |
Caching is the one saving that costs no quality. OpenAI's prompt caching guide says it is on by default for supported models, but reuse requires the entire rendered prefix to match, including instructions, tool definitions and conversation history: change a tool description near the top and nothing after it can match. Anthropic's prompt caching page sets a floor too, and on Claude Sonnet 5.5, Opus 5.5 and Haiku 5.5 a prefix shorter than 512 tokens is not cached at all, with no error returned. At 1.25x to write and 0.1x to read, a cached prefix pays for itself on its first reuse.
Reasoning tokens deserve a warning. Where a model thinks before answering, the thinking is billed as output, and Anthropic's context windows page notes that with adaptive thinking the model sets its own allocation, so usage varies per request. A budget built on reply length will be wrong.
How does the context window set a hard limit?
The context window is the total number of tokens one request may contain, input and output together. Anthropic's context windows page defines it as all the text a model can reference when generating a response, including the response itself: working memory, not training data.
What counts toward it is broader than most people expect: the system prompt, every message including tool results, images and documents, your tool definitions, and the output including extended thinking. Cached tokens count too.
Sizes come from the model. The same page states that most current Claude models have a 1M-token context window, that others including Claude Sonnet 4.5 have 200k, and that one request to a 1M-token model can generate up to 128k output tokens and carry up to 600 images or PDF pages.
Three things happen as a window fills:
- Quality drops before capacity does. Anthropic's page is blunt: more context is not automatically better, and as token count grows, accuracy and recall degrade, which it calls context rot.
- Chat products quietly drop the oldest text. A footnote on the same page says chat interfaces such as claude.ai can manage the window on a rolling first-in, first-out basis. That is why a long chat forgets its opening.
- On the API, you compact or stay under the limit. OpenAI's compaction guide describes setting
context_managementwith acompact_threshold: when the rendered token count crosses it, the server compacts, emits a compaction item and prunes context before continuing.
For a chatbot answering from documents, cost binds long before the window does. For an agent the window fills fast, because every tool result is resent on the next call. My guide to building an AI agent covers that loop.
How do you estimate a monthly API bill from token counts?
Multiply calls by tokens by price, separately for input and output.
monthly cost = calls x input tokens / 1,000,000 x input price + calls x output tokens / 1,000,000 x output price
A worked example, with volumes that are assumptions for illustration, not measurements from an account: a support chatbot handling 10,000 conversations a month, three calls per conversation, 3,000 input tokens per call (800 of fixed instructions, 1,500 of retrieved passages, 700 of conversation so far) and a 300-token reply. That is 10,000 x 3 x 3,000 = 90 million input tokens a month, and 10,000 x 3 x 300 = 9 million output tokens.
Priced against list rates on the OpenAI API pricing page and the Claude pricing docs, both read on 14 November 2026:
| Model | Input per 1M | Output per 1M | 90M input | 9M output | Month |
|---|---|---|---|---|---|
| Claude Haiku 5.5 | $0.10 | $0.50 | $9.00 | $4.50 | $13.50 |
| gpt-6-luna | $0.10 | $0.50 | $9.00 | $4.50 | $13.50 |
| gpt-6.1-terra | $1.00 | $5.00 | $90.00 | $45.00 | $135.00 |
| Claude Sonnet 5.5 | $2.00 | $10.00 | $180.00 | $90.00 | $270.00 |
| gpt-6.1-sol | $2.00 | $10.00 | $180.00 | $90.00 | $270.00 |
| gpt-6-astra | $10.00 | $50.00 | $900.00 | $450.00 | $1,350.00 |
Two things stand out. The tier decides the bill, not the vendor: the cheapest rows from both providers charge the same $0.10 and $0.50, and so do the two mid rows. And output is where the price multiplies, so a prompt that invites long answers costs more. This is running cost only; build hours are a separate question, in my AI agent development cost guide.
How do you cut a token bill without hurting answers?
Start with the repeated text, because it is free to fix. In the example above the same 800 tokens of instructions go out on every call: 24 million tokens a month, $48 at Claude Sonnet 5.5's $2 input rate. Written to a five-minute cache once per conversation and read twice, that text costs $21.60 instead, a saving of $26.40 on a $270 bill that changes no answer.
The checklist I run before quoting a monthly figure:
- Count one real request with the provider's counting endpoint, not characters divided by four.
- Put the unchanging text first in the prompt, so a cache prefix can match it.
- Send retrieved passages rather than whole documents. My RAG chatbot guide covers the retrieval step.
- Run easy traffic on the cheapest model and keep the expensive one for hard cases.
- Set a maximum output length, and test whether the shorter answer is still good.
- Read the
usagefield on live responses for a week before trusting a forecast, and set a spend limit in the provider console on day one.
Where do token estimates go wrong?
Usually because something outside the message text is billed. The ones I see most often:
- Tool definitions and images. Tool schemas are input tokens on every call that carries them, and a character rule cannot estimate an image or a file. Count both through the API.
- Long-context pricing tiers. On Claude Haiku 5.5 the $0.10 input rate applies to prompts up to 100,000 tokens, and prompts over that cost $0.50 input and $2.50 output. OpenAI splits most of its models at 272,000 input tokens, with long-context input at double the short-context rate. A growing prompt can double its own unit price.
- Conversation growth. Input per call rises as a conversation lengthens, because the history is resent each turn. A forecast built on the first message understates the tenth.
- Regional routing. Both providers charge about 10 percent more for pinning inference to a region.
One limit on this guide: list prices change and models are added and retired. The arithmetic stays valid, the numbers do not.
What else do people ask about tokens in AI?
How many tokens is 1,000 words?
Using Google's published rule of 100 tokens to 60 or 80 English words, 1,000 words is roughly 1,250 to 1,670 tokens. On a Claude model with the newer tokenizer the same text runs higher, by about 30 percent on Anthropic's own figure. For code or a non-English script, drop the rule and count.
What is a token in AI, with an example?
Take the sentence "Tokens are how a model reads your text and how your bill is counted." It is 68 characters, so about 17 tokens at four characters each. Common words such as "are" and "how" will be one token; a rare word or a product code would be split into several pieces.
How much does one token cost?
At the list prices I read on 14 November 2026, one million input tokens runs from $0.10 on the smallest models in the table above to $10 on the largest, and output from $0.50 to $50, five times input on every row. One token costs a tiny fraction of a cent, so the number only means anything at volume.
What happens when the context window is full?
It depends where you are. A chat product can manage the window on a rolling first-in, first-out basis, which is why long chats forget their opening instructions. On the API you either keep the request under the model's limit or enable server-side compaction, which replaces earlier turns with a compacted item that carries the state forward in fewer tokens.
Does a bigger context window give better answers?
Not by itself. Anthropic's documentation says more context is not automatically better, and that accuracy and recall degrade as the token count grows, which it names context rot. Curating what goes into the window matters at least as much as how much space it has.
If you want this costed against your real traffic, I do that as part of AI integration work, or by the hour if you hire me as an AI developer, after a free scoping call of about 30 minutes and a written quote within one business day.
Last reviewed 14 November 2026. Disclosure: I build AI agents and chatbots for clients, including WHMCS, WordPress, SEO and server agents, and I am the founder of MagizAI, an AI chatbot and live chat product, so I am not neutral. I am also CTO at ElySpace, a freelance developer for Marmaids LLC, and founder of WHMCSPilot. Every price and limit above comes from the OpenAI, Anthropic and Google documentation linked in the text, read on 14 November 2026.