Safeguard
AI Security•

How context window size affects what you pay

A bigger window does not cost more by itself, but filling it does. Here is how Anthropic, OpenAI and Google price long prompts, and how a growing context compounds across turns.

Safeguard Security Team
3 min read

A context window is a limit, not a charge. You pay for the tokens you send. The two effects that matter are the price bracket your prompt falls into, and how many times a long context gets re-sent. Prices below were read from vendor pages on 18 October 2026.

How vendors price long prompts

  • Anthropic: Claude 4.6 and later models, except Haiku 5.5, include the full 1M token window at standard pricing. The page says a 900k token request is billed at the same per token rate as a 9k token request. Haiku 5.5 is the exception: prompts over 100,000 tokens pay higher prices, and cache reads and writes count toward that length.
  • OpenAI: short context is up to 272K input tokens. Over that, models that list long context rates charge more. For gpt-5.4, input goes from $2.50 to $5.00 and output from $15 to $22.50.
  • Google: Gemini 3.1 Pro Preview is $2 input up to 200k and $4 over. Gemini 2.5 Pro is $1.25 and $2.50. The page lists no long context tier for the Flash models in the table we read.

One request, priced at different sizes

Input cost of a single request in dollars, from the list prices above.

Prompt sizeSonnet 5.5Gemini 3.1 Pro Previewgpt-5.4
10,000$0.02$0.02$0.025
100,000$0.20$0.20$0.25
250,000$0.50$1.00$0.625
500,000$1.00$2.00$2.50

This assumes the higher rate applies to the whole prompt once it crosses the threshold, which is how the pages read for Haiku 5.5. Confirm the exact rule for any model you rely on. On Haiku 5.5 the same 150,000 token prompt costs $0.075 at the over 100,000 bracket price of $0.50, against $0.015 at $0.10 if it fit under the line.

The bigger effect: re-reading

An agent re-sends its context every turn. Start at 10,000 tokens and add 3,000 per turn. Total input tokens billed across the session:

TurnsInput tokens billedCost at $2 per million, uncachedIf nearly all were cache reads at $0.10
20770,000$1.54$0.08
402,740,000$5.48$0.27
8010,280,000$20.56$1.03

Doubling the turns from 40 to 80 nearly quadruples the input, because both the number of calls and the size of each rise. The right hand column ignores cache write premiums and output, so it is a floor, not a bill.

What to do about it

  • Do not fill the window because you can. Send what the task needs.
  • Summarise and restart before the context gets long.
  • Keep stable material at the front so it caches.
  • Check your model's bracket rules before sending very long prompts.

Safeguard can be connected to an agent over MCP with unlimited tool calls, and you can bring your own model, so you choose how much context you pay for. For the per session maths, see estimating a session.

Quick check

Why does doubling the turns more than double the input billed?

Each turn re-sends all earlier context, so later turns carry more tokens than earlier ones.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.