What is a context window? Gemini 3 and the 200k line
A context window is how many tokens a model handles per request. Gemini 3 Pro takes 1M, but past 200k each token costs double. Runnable cost script inside.

A context window is the most tokens a model can handle in one request: everything you send (system prompt, chat history, documents, tool results) plus what it writes back. Gemini 3 Pro, which Google released on November 18, 2025, takes up to 1 million tokens in and writes up to 64,000 out, and its price changes the moment your prompt passes 200,000 tokens.
Why does the context window matter to a builder?
It decides what the model can see, what each call costs and how long you wait. Anything outside the window doesn’t exist for the model. Anything inside it gets billed every time you send it, and since the API keeps no memory between calls, a chat or an agent resends its whole history on every turn.
Gemini 3 Pro adds a price line on top of that. Google’s pricing page (as of November 22, 2025) lists gemini-3-pro-preview at $2 per million input tokens and $12 per million output tokens, thinking tokens included, for prompts up to 200k tokens. Above 200k the rates are $4 and $18. There’s no free tier for this model in the API; it’s free to try in AI Studio.
What does crossing 200k tokens cost?
The table prices a request by the size of its prompt, so as I read it, a 200,001-token prompt pays the higher rate on every token, output included. This script prices a few cases. It needs no API key and no packages.
# context_budget.py: what fits in Gemini 3 Pro's context window, and what it costs.
# Python 3, no dependencies, no API key.
# Numbers: gemini-3-pro-preview, Gemini API paid tier, USD per 1M tokens (Google, 18 Nov 2025).
WINDOW_IN, WINDOW_OUT = 1_000_000, 64_000
TIER = 200_000 # the price changes above this prompt size
PRICE = {"small": (2.00, 12.00), # prompt <= 200k tokens: input, output (incl. thinking)
"large": (4.00, 18.00)} # prompt > 200k tokens
def cost(prompt_tokens, output_tokens):
if prompt_tokens > WINDOW_IN or output_tokens > WINDOW_OUT:
raise ValueError("does not fit")
inp, out = PRICE["small"] if prompt_tokens <= TIER else PRICE["large"]
return prompt_tokens * inp / 1e6 + output_tokens * out / 1e6
# 1. The price line: one token either side of 200k, same 8k-token answer.
for p in (199_999, 200_001):
print(f"prompt {p:>9,} + 8,000 out ${cost(p, 8_000):.4f}")
print()
# 2. How fast media fills the window, at Google's per-item token caps for Gemini 3
# (media_resolution: PDF page at medium 560, image at high 1120, video frame at low 70).
for name, per_item in [("PDF pages (medium)", 560), ("images (high)", 1120), ("video frames (low)", 70)]:
print(f"{name:<20} {TIER // per_item:>6,} before the 200k line {WINDOW_IN // per_item:>6,} to fill 1M")
print()
# 3. A chat that resends its whole history every turn crosses the line on its own.
history, total = 20_000, 0.0 # 20k-token system prompt + docs, then 6k tokens added per turn
for turn in range(1, 41):
total += cost(history, 1_500)
if history > TIER and history - 6_000 <= TIER:
print(f"turn {turn}: prompt {history:,} tokens, now billed at $4 / $18")
history += 6_000
print(f"40 turns, final prompt {history - 6_000:,} tokens, total ${total:.2f}")
Output (Python 3.13.5):
prompt 199,999 + 8,000 out $0.4960
prompt 200,001 + 8,000 out $0.9440
PDF pages (medium) 357 before the 200k line 1,785 to fill 1M
images (high) 178 before the 200k line 892 to fill 1M
video frames (low) 2,857 before the 200k line 14,285 to fill 1M
turn 32: prompt 206,000 tokens, now billed at $4 / $18
40 turns, final prompt 254,000 tokens, total $15.90
Two tokens apart, the same request costs 90% more. The chat in part 3 is made up (20k tokens of setup, 6k new tokens a turn), but its shape is real: nobody decided to cross the line, and by turn 32 every call costs more per token. The media counts come from the per-item caps in Google’s Gemini 3 developer guide, and they ignore your own prompt text, so real numbers are lower.

How does a context window work?
Start with what a language model does: it reads a sequence of tokens and predicts the next one, then appends that token and repeats. To predict well, each new token looks back at the tokens before it through attention. The context window is how long that sequence is allowed to get, a limit set by how the model was trained and how the provider serves it.
That limit isn’t free to raise. In the original transformer paper, Attention Is All You Need, self-attention’s cost per layer grows with the square of the sequence length. Providers have stretched windows to a million tokens anyway. I read Google’s 200k price line as a sign that long prompts still cost more to serve, though Google doesn’t give a reason.
Everything in a request competes for the same space:
- the system prompt and tool definitions, which can be large on their own (I wrote about code execution with MCP for that reason)
- the conversation so far, resent every turn
- documents, images and video frames, each converted to tokens
- the model’s output, including hidden thinking
Gemini 3 Pro lists input and output limits separately: 1M in, 64k out. Thinking tokens are billed as output, which I covered in what reasoning models are, and Gemini 3 Pro thinks at high by default. Setting thinking_level to low is the switch for chat and simple tasks. This is the request shape with the Python SDK; it needs a key, so there’s no output here:
# google-genai==1.51.0
from google import genai
from google.genai import types
client = genai.Client()
resp = client.models.generate_content(
model="gemini-3-pro-preview",
contents="Based on the contract above, list every termination clause.",
config=types.GenerateContentConfig(
thinking_config=types.ThinkingConfig(thinking_level="low"),
),
)
print(resp.usage_metadata.prompt_token_count) # check this against 200,000
Where do long contexts break, and what should you do?
The price line. For Gemini 3 Pro, I’d treat 200k as the working budget and 1M as a ceiling for the rare job that needs it. Log prompt_token_count on every call and alert when it gets near 200k. When a chat grows past that, summarize old turns or retrieve the parts you need instead of resending everything.
Media defaults moved. Google’s migration notes say Gemini 3’s defaults may use more tokens for PDFs and fewer for video than Gemini 2.5. The guide recommends media_resolution_medium (560 tokens) for PDFs because OCR quality “typically saturates” there, and high (1,120) for images. Setting it yourself makes the token count predictable.
Where you put the question. For large inputs the guide says to put your instructions at the end, after the data, and to anchor the question with a phrase like “Based on the information above”. The cost is identical either way, but the answer quality may not be.
Paying for the same context twice. If many requests share a big prefix, like a codebase or a manual, context caching bills cached input at $0.20 per million (prompts up to 200k) plus $4.50 per million tokens per hour of storage. The minimum cacheable size for Gemini 3 is 2,048 tokens.
Latency. More input means more to process before the first token. A million-token prompt at high thinking is a long wait for anyone watching a spinner.
FAQ
Is a bigger context window always better?
A bigger window lets you send more, but you pay for everything you send, every time. I’d rather send 30k well-chosen tokens than 300k tokens of everything, unless the task needs the whole thing at once, like reading a full contract or a long video.
Do output tokens count toward the context window?
Yes, they’re part of the same request. Gemini 3 Pro caps output at 64k tokens, and thinking tokens count as output for billing.
How many pages fit in Gemini 3 Pro’s context window?
About 1,785 PDF pages at medium resolution (560 tokens per page), before any of your own text. Only 357 of those fit under the 200k price line.
Does the 200k line change the output price too?
Yes. Output goes from $12 to $18 per million tokens when the prompt is over 200k, according to Google’s pricing table as of November 22, 2025.
Sources
- Google, Start building with Gemini 3, November 18, 2025
- Google AI for Developers, Gemini 3 Developer Guide (context limits,
thinking_level,media_resolution, prompting advice), as of November 21, 2025 - Google AI for Developers, Gemini Developer API pricing, as of November 22, 2025
- Vaswani et al., Attention Is All You Need, 2017