Every LLM call is billed by the token, and every model has a hard context limit measured in tokens. If you don't budget them, two things happen: your costs drift unpredictably, and requests start failing when a stuffed prompt overflows the window. Token budgeting is the discipline of knowing — before you ship — roughly how many tokens each request uses and what that costs at scale. Here's how to do it.
Tokens 101 (just enough)
A token is a chunk of text — for English, roughly 4 characters or ¾ of a word on average. Both your input (system prompt + context + user message) and the model's output are counted, and providers usually price them separately (output often costs more than input).
Two numbers govern every request:
- Cost = input_tokens × input_price + output_tokens × output_price
- Fit = input_tokens + max_output_tokens must stay under the model's context window
Estimating a prompt's size shouldn't be guesswork. Paste your system prompt, context, or a RAG chunk into the free LLM Token Counter to see the token estimate and how much of each model's window it uses.