The In-Between · Part 2
Why a long AI chat costs more: the API and tokens
We sent Remi three short messages. The first sent 661 tokens, the third sent 848, because each one carried everything before it. Here's what an API is, what a token is, what tokens cost on Claude, OpenAI and Gemini, and a prompt that starts a long chat fresh.
- Runs in
- Any AI chat, plus OpenAI's free Tokenizer page
- Time
- 10 min
Why long chats cost more
An AI model has no memory of your last message. So every time you press enter, the app sends the whole chat again: the instructions, every message you wrote and every reply. You pay for all of it, every time. A chat you've kept open all afternoon costs more per message than a fresh one, even if each new question is short.
What an API is
An API (application programming interface) is a way for one program to ask another program for something. When you chat with an AI app, the app uses an API to ask the model for a reply. It works a bit like texting: a message goes out, a message comes back.
Every request carries three things:
- The model. Which model to use, like Claude Haiku 5.5 or GPT-6 Luna.
- The instructions. What the app tells the model about who it is and how to answer. This is called the system prompt, and it's tomorrow's topic.
- The conversation so far. Every message and reply, from the first one.
The model reads all three, writes a reply, and forgets the lot. Next message, the app sends everything again.
What a token is
Models don't read words. They read tokens. A token is a chunk of text: often a whole short word, sometimes part of a word, a number, or a piece of punctuation.
OpenAI's rule of thumb: "1 token is approximately 4 characters or 0.75 words for English text" (OpenAI docs). Anthropic says a token was about 3.5 English characters on its older models, and its newer models produce about 30% more tokens for the same text (Anthropic glossary). So for English, think three to four characters a token. Other languages and code usually take more.
Why models use tokens
A model works with a fixed list of pieces, called its vocabulary. Whole words would make the list impossibly long, and any new word would break it. Single letters would make every sentence very long. So tokenizers use pieces in between, called subwords.
Most tokenizers build that list with byte pair encoding (BPE). Start with single characters. Find the pair that appears side by side most often in a huge pile of text, like "t" and "h", and add "th" to the list as a new piece. Repeat, hundreds of thousands of times. Common words end up as one piece. Rare words, names and other languages get split into smaller pieces the list already has.
How real words split
We ran these through o200k_base, the tokenizer that OpenAI's tiktoken library uses for GPT-4o and GPT-5. It has 200,019 pieces. The pieces are shown with a space between them.
| Text | Tokens | Pieces |
|---|---|---|
Pratibha | 4 | Pr at ib ha |
cat | 1 | cat |
unbelievable on its own | 3 | un bel ievable |
I find this unbelievable. | 5 | I find this unbelievable . |
Hello | 1 | Hello |
नमस्ते (hello in Hindi) | 4 | न म स्त े |
2026 | 2 | 202 6 |
12345678 | 3 | 123 456 78 |
print("hello") | 4 | print (" hello ") |
https://learn.equationx.ai/prompts | 10 | https :// learn .e qu ation x .ai /prom pts |
What to notice:
- The space usually belongs to the next word. " unbelievable", with its space, is one token. On its own, without the space, it's three.
- Names split. "Pratibha" costs four tokens because the tokenizer saw it less often than everyday words. "cat" costs one.
- Languages differ. "Hello" is one token. "नमस्ते" is four. The same message in Hindi usually costs more than in English.
- Numbers split into chunks of up to three digits.
- Links and code are expensive. One short URL is ten tokens.
Each model family has its own tokenizer, so Claude, GPT and Gemini count the same text a little differently. Use these numbers to build a feel, not as an exact Claude or Gemini count.
Two more terms you'll see on every pricing page:
- Input tokens are what you send: the instructions plus the whole chat. Output tokens are what the model writes back. Output costs more.
- The context window is the most tokens a model can read in one request. Claude Haiku 5.5's is 1,000,000 tokens. Past that, the oldest part of a chat has to be cut or summarised.
Go deeper
- OpenAI Tokenizer: paste any text and see it split into coloured tokens.
- tiktoken on GitHub: OpenAI's open-source tokenizer, the one we used for the table above.
- Anthropic: token counting: how to count tokens for Claude before you send a message. It's free.
- Let's build the GPT Tokenizer: Andrej Karpathy builds a BPE tokenizer from scratch, step by step. Long, and the clearest explanation there is.
- Pricing pages: Anthropic, OpenAI, Google Gemini.
The real Remi test
Remi is the assistant we're building in this series. On 3 November 2026 we sent Remi one chat of three short messages, on Claude Haiku 5.5, and recorded what each one cost.
| Message | Tokens sent in | Tokens back |
|---|---|---|
| 1 | 661 | 52 |
| 2 | 746 | 64 |
| 3 | 848 | 94 |
Message 1 sent Remi's instructions, about 600 tokens, plus the first question. Message 2 sent the instructions, message 1, Remi's first reply, and the new question. Message 3 carried all of that plus the second exchange. Our questions stayed short. The bill grew anyway.
The three messages together cost US$0.00042. That's tiny for one chat. Now picture an app with thousands of users, each with a chat that runs to fifty messages.
These numbers include prompt caching. Caching means the provider stores the repeated start of a request, so the next request can reuse it and pay less for that part. In message 3, 719 of the 848 tokens came from the cache, billed at a tenth of the normal input price on Haiku 5.5.
What tokens cost
Prices per million tokens, standard tier, in US dollars, from each provider's pricing page on 8 November 2026.
| Model | Input | Output |
|---|---|---|
| Claude Haiku 5.5 | $0.10 | $0.50 |
| Claude Sonnet 5.5 | $2 | $10 |
| Claude Opus 5.5 | $4 | $20 |
| Claude Fable 5.1 | $10 | $50 |
| OpenAI GPT-6 Luna | $0.10 | $0.50 |
| OpenAI GPT-6.1 Sol | $2 | $10 |
| OpenAI GPT-6 Astra | $10 | $50 |
| Google Gemini 3.5 Flash-Lite | $0.30 | $2.50 |
| Google Gemini 3.1 Pro Preview (prompts up to 200,000 tokens) | $2 | $12 |
Haiku 5.5's price is for prompts up to 100,000 tokens. Longer prompts cost more.
Two things to take from this table:
- Output costs about 5 to 8 times more than input, at every provider. A model that writes long answers costs more than one that reads long questions.
- The model you pick sets the price. Fable 5.1 costs 100 times what Haiku 5.5 does, for the same number of tokens. Use the small model for simple jobs.
Prices change often. Check the Anthropic, OpenAI and Gemini pages before you plan around them.
Tonight's tip: start fresh with a brief
When a chat gets long, don't keep going. Ask for a short brief, open a new chat, and paste it in. You keep what matters and stop paying to resend the rest.
Paste this at the end of your long chat:
We're going to continue this in a new chat. Write a brief I can paste there so you can pick up where we left off. Keep it under 200 words. Include: 1) The goal, in one sentence. 2) Decisions we've made, and why, in one line each. 3) Facts, numbers and names I gave you that you'll still need. 4) What's done and what's left, as two short lists. 5) Anything I asked you to avoid or always do. Leave out the back and forth, anything we tried and dropped, and anything you're unsure about. Write it as notes to yourself, not to me.
Then start a new chat and paste the brief in, followed by your next question.
Try it yourself: count your own tokens
Anyone. Open the OpenAI Tokenizer, paste a message you sent an AI today, and look at the count. Then paste the same message in another language, or with a link in it, and compare.
If you use Claude Code. Run one message from your terminal and ask for the token counts. You'll need jq, a small tool for reading JSON (on a Mac, brew install jq).
claude -p "your message" --model haiku --output-format json | jq '.usage'
-psends one message, prints the answer and exits.--model haikupicks the model.haikuis short for the latest Haiku.--output-format jsonreturns the answer with its usage details.jq '.usage'shows just the token counts.
What the fields mean:
| Field | What it counts |
|---|---|
input_tokens | Tokens sent in that weren't cached |
cache_creation_input_tokens | Tokens sent in and saved to the cache this time |
cache_read_input_tokens | Tokens sent in and read from the cache, at a lower price |
output_tokens | Tokens the model wrote back |
Add the three input fields together to get everything you sent in. For the cost in dollars, swap jq '.usage' for jq '.total_cost_usd'.
When we sent "Say hi in five words." this way on 8 November 2026, it sent 42,597 tokens in and got 16 back. Claude Code adds its own instructions and tool descriptions to every message, so even "hi" carries a lot. Almost all of it came from the cache, which kept the cost to US$0.00043.
Tomorrow
Day 3 is the system prompt: the instructions that tell a model who it is and how to talk. They're the roughly 600 tokens that rode along with every one of Remi's messages.
The In-Between
- Why a long AI chat costs more: the API and tokens
- Build Remi: your first AI agent in Claude Code
- The system prompt: Remi's full prompt and a ROLE template