Context Estimator
Window math: system + history + prompt + output must fit. Remaining vs max_tokens, not a token counter online.
Select a model to auto-fill constraints, or enter custom ones.
System Message
0 tokensUser Prompt
0 tokensChat History
0 tokensAbout the window, not a token count
- • Budget: system + history + user + markup + output must fit. Remaining is what the completion can use.
- • Markup is about 4 tokens per message. A raw string count misses it.
- • If remaining is under max_tokens, expect a 400 or a truncated answer.
- • This is not a token counter. The counter page totals one string. This page subtracts from the window.
GPT-5.6 Terra openai Reasoning
Mid-tier GPT-5.6: coding and production chat at roughly GPT-5.4 input price with a lower output rate
Cached In: $0.2
| Model | Provider | Context | Input / 1M | Output / 1M | Value |
|---|---|---|---|---|---|
| GPT-5.6 Sol | openai | 1.1M | $5 | $30 | High Context |
| GPT-5.6 Terra | openai | 1.1M | $2 | $12 | High Context |
| GPT-5.6 Luna | openai | 1.1M | $0.2 | $1.2 | High Context |
| GPT-5.5 | openai | 1.1M | $5 | $30 | High Context |
| GPT-5.5 Pro | openai | 1.1M | $30 | $180 | High Context |
Real-World Token Usage Examples
Features
- Adds system + history + user, then ~4 tokens of chat markup per message
- Subtracts from the published window so you see what is left for the completion
- Warns when remaining is under max_tokens: 400 or truncate, not "almost fits"
- Custom window for local models. This is budget math, not a token counter
Common Use Cases
- A 128k window with 120k of RAG leaves almost nothing for the answer
- Chatbots that keep full history until "context length exceeded"
- Reasoning models that spend hidden tokens inside the same window
- Compare GPT vs Claude vs Gemini windows for the same prompt stack
Window math: what still fits, not a token counter
A token counter answers "how many tokens is this string." This page answers what still fits in the window. The budget is system + history + current + role markup + expected output ≤ context window. Every request is stateless: the server does not remember last turn. You resend the whole stack.
If a model is 8,192 and your input is 8,000, you do not have 8,192 left for the answer. You have 192. Set max_tokens above that and the API returns 400 or the completion cuts off. This tool adds about 4 tokens per message for chat role markers. Ignore that and a "it counted as 7,900" prompt still overflows.
Reasoning models spend hidden thinking tokens in the same window. A 1M Gemini window does not mean your 900k RAG dump plus a long answer is free. Long-context tiers also change price. Use the token-counter page for a single string. Use this page for the subtraction.
Examples
Window 8192, input 8000, max_tokens 4096
8000 + 4096 > 8192. The request does not fit.System + 50k retrieved PDF + user question
Remaining must still cover the summary you asked for.Each User/Assistant pair is resent. Old turns are not free.Frequently Asked Questions
No. The counter page totals one blob of text. This page subtracts system, history, user, and markup from a published window and asks whether the completion still fits. Same tokenizer family, different question.
Yes. Input plus completion must fit. If remaining is 200 and you request 4,096 output tokens, expect a 400 or a truncated answer. The warning on this page is that remainder check.
Chat APIs inject role markers. This estimator adds about 4 tokens per system/user/assistant message. A naive character/4 count misses that and overflows in production.
Yes. Hidden thinking shares the budget with your prompt and the visible answer. Leave headroom on reasoning rows or the model spends the remainder thinking and returns little text.
Tips
- If remaining is under max_tokens, shrink history or RAG before you raise the output cap.
- Drop oldest User/Assistant pairs when usage crosses ~85%. The window is not a log file.