Every token is a line on the bill.
Language model APIs charge per token: the input you send (system prompt, conversation, documents, tool definitions) and the output the model writes, at separate rates that differ by model. Cached input is discounted; batch jobs are discounted; reasoning models bill their thinking tokens too. Count tokens for a typical request, multiply by rates and volume, and the bill stops being a mystery.
- Unit
- Tokens, about three-quarters of an English word
- Billed
- Input and output separately, per model
- Discounts
- Cached input, batch processing, smaller models
- Control
- Count, cap, cache, route
- 5production AI apps
- 14engineers led
- 200+students mentored
Questions students ask
The token and pricing questions searched most, answered from paying the bills.
What is token cost in AI?
Token cost is the price an API provider charges for each token a model reads or writes on your behalf. Providers publish rates per million tokens, with input (what you send) cheaper than output (what the model generates) and each model at its own rate: small models cost a small fraction of large or reasoning models. Your bill for a request is input tokens times the input rate plus output tokens times the output rate. Because tokens are small, a single short chat costs a tiny fraction of a cent on a small model, and it is volume, long prompts and expensive models that make bills grow.
How do token costs work?
- Every request is tokenised; the usage object in the response reports input, output and (where offered) cached token counts.
- Input includes everything in the context: system prompt, tool definitions, conversation history, attached documents and the new message.
- Output includes the reply and, for reasoning models, the hidden reasoning tokens.
- Cached input tokens, where supported, are billed at a reduced rate.
- Batch APIs process requests within a window at a discount.
- Rates are per model and change with new releases; always estimate from the current pricing page.
How much does a token cost?
Rates are quoted per million tokens and range, across providers and models, from well under a dollar per million input tokens on small models to tens of dollars per million output tokens on the largest reasoning models; the exact figures change often, so read them from the provider's pricing page when you plan. A useful mental model: a page of text is roughly five hundred to seven hundred tokens, so a thousand pages of input on a small model costs a few dollars at most, and the same on a frontier model costs many times more. Output is usually several times the input rate per token, so long answers are the expensive part.
Does system prompt count as input token?
Yes. The system prompt is sent with every request and is billed as input tokens every time, along with tool definitions and the conversation history. A two-thousand-token system prompt on a chat with a thousand messages a day is two million input tokens a day before anyone types a word. That is exactly what prompt caching exists for: mark the stable prefix (system prompt, tools, fixed documents) for caching and most of those tokens are billed at the cached rate on subsequent requests. Keep the system prompt as short as it can be while still specifying behaviour, and put volatile content at the end.
Do AI agents use tokens?
Heavily. An agent makes many model calls per task, and each call carries the system prompt, the tool definitions, the growing history of tool calls and results, and the new reasoning and output. A ten-step agent task can cost ten to fifty times a single chat turn, with the context growing at each step. That is why agent design is partly cost design: cap steps, summarise or prune history, keep tool outputs short, cache the prefix, use a small model for routine steps and a large one only where it matters, and log tokens per task so you can see the distribution, not only the average.
How does OpenAI API pricing work?
OpenAI bills per million input and output tokens with a separate rate for each model, a lower rate for cached input tokens on prompts that repeat a prefix, and a discount for the batch API. Reasoning models bill their reasoning tokens as output. Fine-tuned models have their own training and inference rates. Image, audio, embedding and search tools have separate prices. You prepay credits and set usage limits in the dashboard; the usage page breaks spend down by model and project. The same structure, with different numbers, applies at most providers, which is why a provider-agnostic cost estimate is easy once you know your token counts.
How does Claude API pricing work?
Anthropic bills per million input and output tokens with different rates for each model tier, a strongly reduced rate for cached input tokens (and a small premium when the cache is written), a discount for batch processing, and extended-thinking tokens billed as output when you enable reasoning. Long contexts beyond a threshold may carry a higher rate on some models. Prepaid credits with spend limits, and a usage dashboard, work as elsewhere. Because Claude is often used with long documents and long system prompts, prompt caching is the single biggest lever on a Claude bill, which is why I mark cache breakpoints in every production prompt.
What are Claude AI tokens?
Tokens are the units Claude reads and writes, produced by its tokenizer from text and, for images, by converting the image into a token count based on its size. Everything in a request is tokens: system prompt, messages, documents, tool schemas, and the reply. The API's usage field reports input, output and cached token counts per request, and a token-counting endpoint lets you measure a prompt before sending it. The context window is a token limit per request. Pricing, rate limits and context all speak in tokens, so a token count is the first number to know about any prompt.
How do Copilot tokens work?
GitHub Copilot and Microsoft Copilot plans do not expose raw tokens to users; they meter usage in requests or credits. GitHub Copilot's paid plans include a monthly allowance of premium requests to the stronger models with additional requests billed beyond it, while basic completions are unlimited on paid plans and capped on the free tier. Microsoft 365 Copilot is licensed per user with usage limits on some features. Under the hood tokens are still what the models consume, but you budget in requests. Check the current plan pages for the allowances, which change frequently.
How much does an LLM cost?
Three answers. Using one: free in the chat apps' free tiers, a monthly subscription for the paid tiers. Calling one: per-token API pricing as above, from fractions of a cent per request on small models to cents or more per long request on frontier models, scaled by volume. Running one yourself: the hardware, a GPU costing hundreds to thousands per month to rent for a capable open model, plus engineering time, against which per-token APIs are often cheaper until volume is large or privacy forces it. For a student project, free tiers and a small prepaid credit cover everything; for a product, model the cost per user per month before you choose a model.
Cut the bill
In the order that saves the most.
- 01
Measure
Log input, output and cached tokens per request; find the top prompts by spend.
- 02
Cache
Stable prefix first; cache breakpoints; watch the cached-token count rise.
- 03
Route
Small model for routine requests, large model for the hard minority; a classifier or rules decide.
- 04
Trim
Shorter system prompts, retrieved passages instead of whole documents, capped output lengths.
In the room
Where these systems get explained to students.


Read next
Context, caching and the providers.
An AI bill that surprised you?
I find where the tokens go and cut the cost with caching, routing and trimming, without losing quality.

