AI Tokens Explained: What They Cost and How to Use Fewer
What a token is, how to estimate them, why long chats and long answers cost the most, and seven habits that use fewer tokens without worse answers.
Every AI model, from ChatGPT to Claude to Gemini, reads and writes in tokens. API prices are per token, context windows are measured in tokens, and the usage limits on chat subscriptions come down to tokens too. Yet most people never see one.
This guide explains what a token is, how to estimate how many you're using, what actually drives the cost of a conversation, and simple habits that use fewer tokens without getting worse answers.
What is a token?
A token is a chunk of text: often a whole common word, sometimes part of a longer word, a punctuation mark or a space plus a word. Models don't see letters or words directly; text is split into tokens, and each token becomes a number the model works with.
For example, OpenAI's current tokenizer (o200k_base) splits "Tokenization isn't magic." into five tokens:
Token | ization | ␣isn't | ␣magic | .
The ␣ marks a space, which usually travels with the word after it. Common words are one token each; rarer words break into pieces. "Ryujin", the name of this site's dragon, becomes three: ␣Ry, uj, in.
The exact split depends on the model: each family has its own tokenizer, so the same text can be a different number of tokens in different models.
Rules of thumb
OpenAI's rule of thumb for English:
- 1 token ≈ 4 characters
- 1 token ≈ ¾ of a word
- 100 tokens ≈ 75 words
So a 1,500-word article is roughly 2,000 tokens. Two things push the count up:
- Other languages. Many languages use more tokens than English for the same meaning, because tokenizers are trained on text that's mostly English. Text in Malay, Chinese, Tamil or Thai often costs noticeably more tokens per sentence than its English equivalent.
- Code and data. Brackets, indentation, long identifiers, numbers and Base64 all split into many small tokens. A minified JSON file can be surprisingly expensive.
For a quick estimate, take the character count (the case converter's text counts show it) and divide by four.
Why tokens matter
Cost
APIs charge per million tokens, with separate prices for input (what you send) and output (what the model writes). Output usually costs several times more per token, because generating text is the expensive part.
Take an example price of $3 per million input tokens and $15 per million output tokens. A request with a 3,000-token prompt and an 800-token answer costs:
input: 3,000 × $3 / 1,000,000 = $0.009
output: 800 × $15 / 1,000,000 = $0.012
total: $0.021
Tiny on its own. Multiply by thousands of users, or by an agent making hundreds of calls, and it adds up quickly. Notice that the shorter answer cost more than the longer prompt.
Context window
Every model has a maximum number of tokens it can consider at once: the context window. It covers everything in the request: instructions, conversation history, documents, and the answer being written. Current models offer anywhere from tens of thousands to a million or more tokens, but more isn't free: very long contexts cost more, take longer, and models can pay less attention to details buried in the middle.
Speed
Models write one token at a time. A 2,000-token answer takes several times longer to arrive than a 300-token one, which matters for chat responsiveness and for agents that make many calls in a row.
Usage limits
Chat subscriptions don't show prices per message, but their usage limits are driven by the same thing: how much the model reads and writes. Long chats with big attachments use up your allowance faster than short, focused ones.
What counts as tokens (more than you'd think)
Every time you send a message, the model processes:
- The system prompt set by the app, and your custom instructions, on every message.
- The whole conversation so far. Models don't remember between requests; the app sends the history again each time.
- Attachments: documents, pasted code and images (images are converted to tokens too, more for bigger ones).
- Tool definitions and tool results, when the AI can search the web or use other tools.
- Thinking. Models with a reasoning or "thinking" mode generate tokens you may never see, and they're billed as output.
- Your actual question and the answer.
That second point is the big one. If every exchange in a conversation adds about 1,000 tokens, then message 20 sends roughly 20,000 tokens of history along with it. Over twenty messages, the model reads about 210,000 input tokens in total, against 20,000 for twenty separate one-message chats. (Prompt caching, below, softens this for apps that use it.)
Seven habits that use fewer tokens
- Ask for the length you need. "In 3 bullets", "under 150 words", "only the corrected function". Output is the expensive side, and unrequested detail is the most common waste. How to write better AI prompts has more on this.
- Start a new chat for a new topic. It drops the old history, and the old details stop leaking into new answers.
- Paste the relevant part, not everything. The function with the bug, not the whole repository; the section of the contract, not all 40 pages.
- Trim the filler. Greetings, apologies and repeating the same instruction three ways cost tokens and change nothing.
- Keep custom instructions short. They're sent with every single message.
- Use a lighter model for easy jobs. Rewording an email doesn't need the largest model. Smaller ones are cheaper per token and faster.
- Edit instead of correcting. If an answer went wrong because the prompt was unclear, edit the original prompt rather than adding "no, I meant…" messages that all stay in the history.
Prompt Maid, a free skill I built, automates the first and fourth habits: start a message with maid: and it removes the filler and asks for the format and length the task needs. In its tests the tidied prompts weren't shorter overall (they spend words on the answer's shape), so the bet is on right-sized answers and fewer retries, which haven't been measured yet.
Tips for developers
- Count before you send. OpenAI's
tiktokenlibrary counts tokens for its models, and Anthropic's API has a token-counting endpoint (/v1/messages/count_tokens) for Claude. Use the provider's own counter for anything that affects money or limits.
import tiktoken
encoding = tiktoken.get_encoding("o200k_base")
tokens = encoding.encode("Hello, Ryujin! How many tokens is this sentence?")
print(len(tokens)) # 13
- Cache the prefix. Major APIs offer prompt caching: if many requests share the same beginning (a long system prompt, a document, tool definitions), the cached part is billed at a large discount and processed faster. Put the stable content first and the changing part last.
- Set a maximum output length. A
max_tokenslimit keeps a runaway answer from becoming a runaway bill. - Trim history in long-running chats. Summarise older turns, or keep only the last few, instead of resending everything forever.
- Send compact data. Pretty-printed JSON with indentation costs more tokens than the same data minified. The JSON formatter minifies in one click.
- Batch work that isn't urgent. Several providers offer cheaper batch APIs for requests that can wait.
Summary
- A token is a chunk of text, roughly 4 characters or ¾ of an English word. Other languages and code use more.
- Cost, context limits, speed and usage limits all come down to tokens, and output tokens usually cost the most.
- Each message resends the whole conversation, so long chats get more expensive with every reply.
- Ask for the length you need, start fresh chats, paste only what's relevant and cut the filler: you'll use fewer tokens and usually get better answers too.