Costs · November 17, 2026 · 7 min read

Long-context price steps: the token count where your agent's bill quietly doubles

Several model APIs charge more per token once a single prompt crosses a length threshold, and agent loops cross it without telling you. Here is where the steps sit today at OpenAI, Anthropic, Google and xAI, what they cost, and how to keep a long run under the line.

Some links are affiliate links; we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases. Disclosure

Most cost math for agents assumes a straight line: twice the tokens, twice the bill. For a lot of models that is no longer true. Several providers now price a request by how long its prompt is, and once a single request crosses a threshold, every token in it gets the higher rate, not just the ones past the line. A chat app rarely notices, because a chat prompt is small. An agent loop notices on turn eighteen of a long coding session, when the history finally gets big enough, and nothing in the response tells you it happened except the invoice.

This post walks through where those steps sit today, using the providers' own pricing pages, then shows the arithmetic on a realistic loop and the handful of habits that keep a long run on the cheap side of the line.

OpenAI: 272K input tokens, and the whole request reprices

OpenAI's flagship text models share one rule. The GPT-6.1 Sol model page lists standard prices of $2.00 per million input tokens, $0.10 cached input and $10.00 output, then adds one sentence that matters more than the table: "API prompts with more than 272K input tokens are priced at 2x input and cache rates and 1.5x output for the full request." The GPT-6 Astra page carries the same rule on top of its $10.00 input and $50.00 output, and the main pricing page has a separate Short and Long context-length toggle for the whole flagship table, which is a hint that this is not a one-model quirk.

Two words in that sentence do the damage. "Full request" means the multiplier is not a marginal rate on tokens past 272K; it applies to every input token, every cached token and every output token in the call. And "cache rates" means prompt caching does not shelter you. A cached prefix still gets cheaper than uncached input, but it gets twice as expensive as it was a turn earlier.

The output side is easy to overlook because it is only 1.5x, but agents that write code or long reports produce a lot of output on exactly the turns where the context is largest. A big final summary written at the end of a long session is the most expensive output you will ever pay for.

Anthropic: flat for most models, a 100K step on Haiku

Anthropic went the other way on its larger models. The Claude pricing page says Claude 4.6 and later models, except Claude Haiku 5.5, "include the full 1M token context window at standard pricing," and gives the example that a 900K-token request is billed at the same per-token rate as a 9K-token request. Prompt caching and batch discounts also apply at standard rates across the full window. If your agent runs on Claude Opus 5.5 or Sonnet 5.5, there is no step to plan around.

Haiku 5.5 is the exception, and its step is lower and steeper than OpenAI's. The same page lists $0.10 per million input tokens and $0.50 output for prompts up to 100,000 tokens, and $0.50 input and $2.50 output for prompts over 100,000 tokens. Cache reads go from $0.01 to $0.05, and five-minute cache writes from $0.125 to $0.625. That is a 5x jump on everything, at a threshold a busy tool loop can reach in a few turns.

The page is also unusually precise about how the line is measured, and the details close every loophole you might hope for. A request's prompt length "counts all of its input tokens, including cache reads and cache writes." Each request is priced on its own, so a request over the threshold "pays the higher prices even when part of its prompt is a cache hit," while earlier requests keep the prices they were billed at. In other words, you cannot cache your way under the line, but crossing it on turn twelve does not reprice turns one through eleven either.

Google: 200K on older Pro models, flat on Gemini 4

Google's Gemini API pricing page shows both patterns side by side. Gemini 3.1 Pro Preview charges $2.00 per million input tokens and $12.00 output for prompts of 200K tokens or less, and $4.00 input and $18.00 output above that, with context caching going from $0.20 to $0.40. Gemini 2.5 Pro has the same 200K split at $1.25 and $10.00 below the line, and $2.50 and $15.00 above it. Google notes that output pricing includes thinking tokens, so a reasoning model that thinks hard on a long prompt pays the higher output rate on all of that thinking too.

The Gemini 4 models on the same page list a single rate with no prompt-length split. Gemini 4 Carbon and Gemini 4 Argon both show $2.00 input and $10.00 output through November 30, 2026, then $4.00 and $20.00 starting December 1, 2026. That is a different kind of step, a calendar one rather than a context one, and it is worth putting in your budget now if you are testing either model at the promotional rate.

xAI: a stated 200K boundary

xAI's Grok 4.7 model page lists a 500K context window and has a "Higher context pricing" section that says it charges "different rates for requests which exceed the 200K context window." The models overview gives the standard rates of $2.00 input and $6.00 output per million tokens. Check the higher-context figures on the model page itself before you rely on a long Grok run, since that section is where xAI publishes them.

What the step does to a real loop

Here is the arithmetic on GPT-6.1 Sol, using only the prices above. A request with a 250,000-token prompt and 2,000 tokens of output costs $0.50 in input and $0.02 in output, about $0.52. Add 30,000 tokens of tool results so the prompt is 280,000 tokens, and the input rate doubles to $4.00 per million, which makes the input $1.12. Output goes to $15.00 per million, so the same 2,000 tokens cost $0.03. The request now costs about $1.15. Twelve percent more tokens, a bit more than double the money.

Now picture how a loop gets there. Say a coding agent starts with a 20,000-token system prompt and tool definitions, and each turn adds about 15,000 tokens of file reads, test output and model reasoning to the history. After turn n the prompt is roughly 20,000 plus 15,000 times (n minus 1). That passes 272,000 on turn 18. Every turn after that pays the long-context rate on the entire history, and because the history keeps growing, the per-turn cost climbs on two axes at once: more tokens, each at twice the price.

Haiku 5.5 shows the same shape at a smaller scale. A 95,000-token prompt costs about $0.0095 in input. A 105,000-token prompt costs about $0.0525. If you picked Haiku because it is cheap and then let its history drift past 100K, you are paying five times its headline rate, which can put it above a larger model's flat price on some turns.

Keeping a run under the line

The first habit is to measure before you send. Every provider above has a token counting route, and our post on counting tokens before you send covers them. Put a check in the loop that compares the counted prompt against the step for the model you are calling, with some margin, and treat crossing it as an event your code decides about rather than something that happens to you.

The second is to compact on a budget tied to the step, not to the context window. A model with a 1,050,000-token window and a 272K price step should compact well before 272K, not near a million. Our context compaction guide covers the mechanics; the change here is only where you set the trigger. Trimming at the source helps even more: a tool that returns the 40 relevant lines of a log instead of the whole file keeps the history small without any summarizing at all.

The third is to route long jobs to flat-priced models on purpose. If a task genuinely needs 600,000 tokens of context, such as reading a large codebase in one pass, the price step is a reason to send that one call to a model that bills the full window at its standard rate, and keep the stepped model for the short, frequent turns where it is cheapest. Our model routing post has the general pattern.

The last is to log the prompt length next to the cost of every request. Usage objects already report input tokens, so the extra work is one comparison. When the bill jumps, the first thing you want to know is whether the agent did more work or just did the same work above a line, and that log answers it in seconds.

If you want a longer treatment of how cost, latency and context trade off when you build on foundation models, AI Engineering by Chip Huyen is a solid book-length reference. The prices in this post come from the providers' pages as of November 17, 2026, and our model data tracks the standard rates as they change.

Newsletter

The daily agent toolkit.

New tools, MCP servers and frameworks, in one short email every morning. Free, no spam. Sign up and get the free AI agent cost cheat sheet (PDF).