01 · Introduction
What a token is
A language model does not see letters or words. It sees tokens: small pieces of text. "Hello" is one token; "unbelievable" might be three; a Chinese sentence is usually one token per character or two.
Tokens matter for three reasons:
- Price. Every API call is billed per token, separately for what you send (input) and what the model writes (output). Output is usually several times more expensive.
- Limits. A model can hold only so many tokens at once: its context window. Long documents must fit inside it.
- Speed. More output tokens means a longer wait.
A useful rule of thumb: 1,000 English words is about 1,300 tokens; 1,000 Chinese characters is about 1,000 to 2,000 tokens depending on the model.
02 · When to use it
When tokens matter to you
- Budgeting an agent that runs every day. Runs × tokens × price = the monthly bill.
- Fitting a long document. A 200-page PDF does not fit in most context windows; you summarize or split it first.
- Choosing a model. A cheaper, smaller model costs a fraction per token and is often good enough for sorting and summarizing.
- Explaining a surprise invoice. Nine times out of ten the cause is a prompt that pastes a whole document into every call.
03 · Setup
Counting tokens before you spend them
- Take one typical input (an email, a page, a record) and paste it into a tokenizer page. Note the count.
- Estimate the output you expect: a two-line summary is about 60 tokens; a full page is about 600.
- Look up the model's price per million tokens for input and output.
- Multiply: (input + output tokens) × runs per day × 30 days. Compare the number with the value of the task.
The API answer of every call also reports the exact input_tokens and output_tokens. Log them.
04 · How to use it
Spending fewer tokens
- Send less. Strip signatures, HTML and quoted replies before the model sees an email.
- Ask for less. "Answer in one sentence" cuts output cost and reading time.
- Route by difficulty. Let a small model decide is this relevant? and send only the relevant items to the strong model.
- Cache what repeats. The same instructions sent on every call can be cached by the provider at a discount; the same document summarized twice is money wasted.
- Watch the context grow. In a long chat every turn resends the whole history. Start a new conversation when the topic changes.
05 · Pitfalls
Pitfalls
- Prices differ by model by a factor of 10 to 50. Check the price page, not your memory.
- "Thinking" or reasoning tokens are billed as output even though you do not see them.
- Images, PDFs and audio are converted to tokens too, and a page of PDF can cost more than a page of text.
- A hard token limit in your code (
max_tokens) that is too small cuts the answer off mid-sentence.
06 · Resources
Where to go next
Each provider publishes a price page and a tokenizer. Keep both open while you design a workflow.
My notes
Sign in to keep private notes on this handbook.Sign in
