Context Estimator

Context Estimator

Updated August 27, 2026

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 tokens

User Prompt

0 tokens

Chat History

0 tokens
Total Used
0
+0 overhead
Remaining
128K
Safe Budget
Max Output
8,192
Limit: 8,192
Window Used
0.0%
Capacity
Context Capacity 0 / 128K
System
History
Prompt

About 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

Cost per 1M Tokens
In: $2 | Out: $12
Cached In: $0.2
Compare Similar Models
ModelProviderContextInput / 1MOutput / 1MValue
GPT-5.6 Solopenai1.1M$5$30High Context
GPT-5.6 Terraopenai1.1M$2$12High Context
GPT-5.6 Lunaopenai1.1M$0.2$1.2High Context
GPT-5.5openai1.1M$5$30High Context
GPT-5.5 Proopenai1.1M$30$180High Context

Real-World Token Usage Examples

Standard Tweet
~35
tokens
1-Page Document
~500
tokens
10-Min Transcript
~2,000
tokens
100k Word Book
~135k
tokens

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

Invalid - Input leaves no room for max_tokens
Window 8192, input 8000, max_tokens 4096
8000 + 4096 > 8192. The request does not fit.
Valid - RAG eats the window
System + 50k retrieved PDF + user question
Remaining must still cover the summary you asked for.
Valid - History is part of the budget
Each User/Assistant pair is resent. Old turns are not free.

Frequently Asked Questions

Is this a token counter?

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.

Does output count against the window?

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.

What is the per-message overhead?

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.

Do reasoning tokens use the same window?

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.

Common Mistakes

Calling this a token counter and ignoring remaining vs max_tokens
Filling a 1M window with retrieval and leaving no room for the answer
Forgetting that each past turn is resent on every request