All guides

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:

  1. The model. Which model to use, like Claude Haiku 5.5 or GPT-6 Luna.
  2. 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.
  3. 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.

TextTokensPieces
Pratibha4Pr at ib ha
cat1cat
unbelievable on its own3un bel ievable
I find this unbelievable.5I find this unbelievable .
Hello1Hello
नमस्ते (hello in Hindi)4न म स्त े
20262202 6
123456783123 456 78
print("hello")4print (" hello ")
https://learn.equationx.ai/prompts10https :// learn .e qu ation x .ai /prom pts

What to notice:

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:

Go deeper

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.

MessageTokens sent inTokens back
166152
274664
384894

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.

ModelInputOutput
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:

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:

Prompt

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'

What the fields mean:

FieldWhat it counts
input_tokensTokens sent in that weren't cached
cache_creation_input_tokensTokens sent in and saved to the cache this time
cache_read_input_tokensTokens sent in and read from the cache, at a lower price
output_tokensTokens 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.