Title card reading CONTEXT BUDGET beside a segmented vertical container with space left at the top

LLM Context Budget Planner: Find Where Your Conversation Breaks

Figures on this page were verified 31 August 2026 against the providers' own documentation. Pricing, context windows and rate limits change without notice, so confirm any number against the provider before you rely on it. Tell us if something here is out of date.

Most context-window failures are not caused by one huge message. They are caused by fixed overhead you forgot you were paying on every single request. A large system prompt, a fat set of tool definitions and a generous max_tokens can consume a third of the window before the user types anything. This tool shows exactly how much room is left and at which turn the conversation breaks.

Context budget planner

Enter your fixed overhead and typical turn sizes. It works out how much of the window is left and where the conversation breaks.

Runs entirely in your browser. Nothing is sent anywhere.

conversation turns before the window is full
Context windows verified 31 August 2026 against Anthropic and OpenAI documentation. Token counts you enter are estimates; measure with a token counting endpoint when close to the limit.

What counts against the window

Everything in the list below shares one budget. The window is not “how long your prompt can be”, it is the total of what goes in and what comes out.

  • System prompt. Sent on every request, never amortised.
  • Tool definitions. The full JSON schema of every tool, on every call, whether or not the model uses them. This is the most commonly overlooked line and the easiest to cut.
  • Conversation history. Every prior turn, resent in full. This is what grows.
  • The current message.
  • Reserved output. max_tokens is subtracted up front, not measured afterwards. Reserving 128,000 tokens costs you 128,000 tokens of headroom even if the reply is one line.

Why the turn count matters more than the total

A single request that fits tells you very little. In a chat application the history compounds: turn 20 carries all nineteen previous turns plus your fixed overhead. Teams usually test with two or three turns, see plenty of headroom, and ship something that fails for real users in a long session.

Plan for the conversation length you actually expect, then add a trimming strategy before you need one.

When the numbers look bad

  1. Cut max_tokens first. It is pure reservation and usually set far above what the reply needs. This is the cheapest fix and it also frees rate-limit headroom.
  2. Audit tool schemas. Long descriptions and verbose parameter documentation cost tokens on every request forever. Tighten them once, save continuously.
  3. Trim history deliberately. Keep a rolling window of recent turns and summarise older ones into a short running brief. Do not let the transcript grow unbounded.
  4. Shorten the system prompt. It is fixed overhead. Every token you remove is a token returned on every call you will ever make.
  5. Change model last. A bigger window does not fix a wasteful prompt, and you pay for every token you send.

A note on token estimates

The numbers you enter here are estimates, and tokenizers differ between providers and between model generations. For anything close to the ceiling, measure rather than estimate. Anthropic exposes a token counting endpoint that uses the same tokenizer as the model, so the count is exact rather than approximate.

count = client.messages.count_tokens(
    model="claude-opus-5",
    system=SYSTEM_PROMPT,
    tools=TOOLS,
    messages=history,
)
print(count.input_tokens)

Counting the system prompt and tools together, as above, is the number that matters. Counting the user message alone hides the overhead this whole page is about.

Related

When this budget is exceeded you get context_length_exceeded. Reserved output also drives truncated responses and counts toward token-per-minute rate limits. To see what a given token volume costs, use the LLM API cost calculator.

Full error coverage is in our LLM API error reference.

Frequently asked questions

What does the planner actually calculate?

It subtracts your system prompt, tool definitions and reserved max_tokens from the model's context window, then divides what remains by your average turn size to show how many exchanges fit before the conversation runs out of room.

Why does my conversation break earlier than I expect?

Because history accumulates. Every turn resends everything before it, so the usable space shrinks with each exchange while the system prompt and tool definitions stay as fixed overhead that never shrinks.

Does it upload my prompt?

No. Everything runs in your browser and nothing is transmitted, which is why you can safely paste a real production system prompt into it.