Home / Tools / Context window

Context window calculator

Budget system prompt, history, retrieved docs, the user message, and reserved output against a model window. See whether the request fits before you call the API.

OpenAI · window 1,000,000 tokens · Exact counts · rates checked 2026-08-12

Usable window after margin: 900,000 of 1,000,000 tokens.

Fit
Fits with room
Input total
9,100
With reserved output
9,612
Remaining
890,388 (1% used)
BucketTokens% of usable
System prompt8000.1%
Chat history2,0000.2%
RAG / docs6,0000.7%
User message3000.0%
Reserved output5120.1%

Models that fit this budget

Same total (9,612 tokens) against published windows. Smallest fitting windows first.

ModelWindowHeadroom
GPT-3.5 Turbo
OpenAI
16,3846,772
Gemini 1.0 Pro
Google
32,76823,156
Grok 2 Vision
xAI
32,76823,156
Mistral Saba
Mistral
32,76823,156
Mistral Tiny
Mistral
32,76823,156
Open Mixtral 8x7B
Mistral
32,76823,156
Mixtral 8x7B (Groq)
Groq
32,76823,156
Mistral 7B (Together)
Together AI
32,76823,156
Qwen2.5 72B (Together)
Together AI
32,76823,156
Qwen2.5 7B (Together)
Together AI
32,76823,156
Qwen2.5 Coder 32B (Together)
Together AI
32,76823,156
Qwen2.5 32B (Fireworks)
Fireworks
32,76823,156

How to use this

  1. Pick the model you plan to call.
  2. Enter token budgets for system, history, docs, and the user message, or paste a document to count the docs bucket.
  3. Reserve output tokens for the reply you actually need.
  4. Read the fit verdict, then open the cost calculator if the request fits.

Related tools

RAG cost · Cost calculator · Long-context pricing

Related guides

Context windows and overflow · Will my document fit? Context window calculator · Context budgeting for RAG · What happens when you exceed the context window · Why you must reserve output tokens

Sources and references

Official documentation used for definitions, counting methods, or rate cards. Always confirm critical budgets on the provider page.

FAQ

What is a context window?
The maximum tokens a model can hold in one request. Input and the reserved reply share the same budget.
Why reserve output tokens?
The reply consumes the same window as your prompt. If you fill the window with input, the answer gets truncated or the API rejects the call.
Are paste counts Exact?
OpenAI encodings are Exact in the browser. Other providers are Approx. Confirm critical budgets with the provider count API before production.
What does the safety margin do?
It shrinks the usable window for planning (default 10%). That buffer covers tool wrappers, formatting tokens, and tokenizer drift on Approx models.