AI API pricing comparison, July 2026: what actually changes your bill

Updated 2026-07-15

As of July 2026, official per-token rates from OpenAI, Anthropic, and Google have barely moved this year: flagship models still run $2 to $5 per million input tokens and several times that on output, while DeepSeek, GLM, Kimi, and MiniMax price a comparable class of task at a small fraction of that. The bill you actually pay depends less on which provider you pick and more on which model tier handles each request, so the fastest real savings come from routing routine calls to a cheaper model instead of waiting for list prices to move.

Quick answer: the sticker price is not the whole story

Three things decide what an AI API actually costs you: which model tier a request lands on, how much context gets resent as input tokens, and whether you are billed at a provider's official list price or a lower rate through a routing layer. The sticker price on a pricing page answers none of that on its own. Line up July 2026 official rates and the spread across a roughly comparable capability tier is large. OpenAI lists GPT-5.5 at $5 per million input tokens and $30 per million output. Anthropic lists Claude Sonnet 4.6 at $3 input and $15 output. Google lists Gemini 3.5 Flash at $1.50 input and $9 output. xAI lists Grok 4.5 at $2 input and $6 output. DeepSeek V4 Flash is $0.14 input and $0.28 output at official rates, and Zhipu's GLM-5 lands near $0.57 input and $2.57 output. That is roughly a 36x gap between the cheapest and most expensive model here on input tokens alone, and the gap on output tokens is over 100x. None of those numbers are being compared unfairly; they are each provider's own published per-million-token rate. What changes the real comparison is your workload. A support bot answering short questions burns mostly input tokens against a thin system prompt, while an agentic coding tool resends a growing file list on every turn and can rack up ten times the token volume for the same hour of work.

Where the money actually goes

The caching ratio above is not a rule of thumb pulled from nowhere. On GPT-5.6 Sol, a fresh input token is priced at $4 per million while a cached read is $0.40, exactly a tenth. Media pricing runs on a different meter entirely: GPT Image 2 bills near $0.0225 per official call rather than per token, so a few hundred image generations can outweigh a full day of text chat on the same account.

  • Input tokens, not output, usually drive the bill. Every request resends the system prompt, tool schemas, and whatever chat history or retrieved context you attach, and all of it is billed as input on every single call.
  • Output tokens cost more per token, often four to six times the input rate, but are typically a small share of total volume unless the task is long-form generation.
  • Prompt caching changes the math where it is supported: a cached read commonly bills at a small fraction of the fresh input rate, while a first-time cache write costs a premium above the base rate.
  • Image and video generation are usually billed per call or per output unit, not per token, so a single media request can cost as much as a large batch of chat completions.
  • Retries and timeouts double-bill. A request that fails after the model already generated tokens, or one your client retries automatically, gets charged again on the next attempt.

A worked example: the same workload across four models

Put real volume behind the rates instead of comparing them in the abstract. Assume a mid-size feature, a support chatbot or an internal tool, handling around 10,000 requests a month, averaging 2,000 input tokens (system prompt plus recent chat history) and 400 output tokens per request. That is 20 million input tokens and 4 million output tokens for the month, a realistic mid-tier production load rather than a demo. The table below prices that exact workload on four models spanning the range from the previous section, at both official list price and a discounted gateway rate for the same model IDs. The gap between the two right-hand columns is the entire case for routing traffic deliberately: the same 24 million tokens costs anywhere from about $3.50 to $220 a month depending only on which model answers each request.

Workload: 20M input tokens + 4M output tokens per month (about 10,000 requests averaging 2,000 in / 400 out). Official list prices are each provider's published per-million-token rate; gateway prices are the same model IDs through an OpenAI-compatible routing layer.
ModelOfficial list ($/1M in / out)Monthly cost at official listGateway price ($/1M in / out)Monthly cost through gateway
gpt-5.5$5.00 / $30.00$220.00$4.00 / $24.00$176.00
claude-sonnet-4-6$3.00 / $15.00$120.00$2.40 / $12.00$96.00
glm-5$0.57 / $2.57$21.71$0.51 / $2.31$19.54
deepseek-v4-flash$0.14 / $0.28$3.92$0.126 / $0.252$3.53

Why the actual bill still surprises teams

None of this requires a price change anywhere to fix. It requires actually logging which model, how many tokens, and how many dollars each request cost, then looking at the distribution across requests instead of a single monthly average.

  • Dev and prod run different traffic patterns. Teams prototype on the flagship model because it is the default in the docs, then ship without testing whether a mid-tier model handles most requests just as well.
  • Context grows quietly. A chatbot that starts a session at 500 tokens of history can be at 5,000 tokens by the twentieth turn, and every one of those tokens is billed again on every later turn until the session resets.
  • Nobody budgets for retries. A client-side timeout that fires while the model is still generating, followed by an automatic retry, bills the same request twice with nothing extra to show for it.
  • Cache write premiums get ignored. Turning on prompt caching for a prefix that is rarely reused can cost more than it saves, because the write premium only pays off once the same prefix is hit enough times.
  • Per-call media pricing hides inside a token-shaped mental model. A team that thinks entirely in tokens can be surprised that a handful of image or video calls costs as much as thousands of short chat completions.

Three ways to buy access, compared

Once you know where the money goes, the remaining decision is how you buy access to the models at all. There are three practical routes, and most production teams end up using more than one of them at the same time.

OptionPricing basisOngoing overheadBest fit
Direct provider APIOfficial per-token list price, billed by each providerA separate account, key, and dashboard per provider you useTeams that need one provider's newest features on day one
Self-hosted open-weight modelCompute cost, not per-token billingGPU capacity planning, scaling, and uptime workSteady, high-volume workloads with in-house infrastructure
OpenAI-compatible multi-model gatewayPer-token, often below official list on the same model IDsOne account and one usage log across every model routed through itApps that route different tasks to different models under one bill

Six ways to cut the bill without downgrading quality

The last item compounds with the first. Routing a budget-tier model through a discounted endpoint can turn a request that costs several cents at official rates into a fraction of a cent, without touching how the flagship tier handles the requests that still need it.

  • Right-size the model per task. Route classification, summarization, and short replies to a budget model, and reserve the flagship tier for requests that genuinely need deep reasoning or long-form writing.
  • Cap max_tokens per request type. An open-ended max_tokens on a verbose model is one of the easiest ways to overpay for output nobody reads.
  • Trim the system prompt and tool schemas. Everything in there gets resent and rebilled on every call in every session, so a few hundred tokens saved per call compounds across thousands of requests.
  • Turn on prompt caching only for prefixes that actually repeat, and skip it for one-off requests where the write premium will not pay back.
  • Log model, token counts, and dollar cost per endpoint, not just per account, so one noisy feature shows up before the monthly invoice does.
  • Route cost-insensitive or high-volume traffic through a cheaper OpenAI-compatible endpoint. APIsRouter is one option: pay-as-you-go with no subscription, global models like GPT and Claude priced 20% below official list, and Chinese-developed models such as DeepSeek and GLM priced below their own official rates.

Point your client at a lower rate without changing your code

If your existing code already targets an OpenAI-compatible chat completions endpoint, changing where a request is billed is a base URL and key change, not a rewrite. Point base_url at the gateway's OpenAI-compatible endpoint, https://api.apisrouter.com/v1, use an exact model ID, and the request and response shapes stay the same as whatever you already call today. Test with a single request before pointing production traffic at a new endpoint:

curl https://api.apisrouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-APIsRouter-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "Reply with one word: ok"}],
    "max_tokens": 16
  }'

FAQ

How much do OpenAI, Anthropic, and Google APIs cost per million tokens in 2026?

At official list prices in July 2026, GPT-5.5 is $5 input and $30 output per million tokens, Claude Sonnet 4.6 is $3 input and $15 output, and Gemini 3.5 Flash is $1.50 input and $9 output. Budget-tier models from DeepSeek, GLM, Kimi, and MiniMax price a comparable class of task at a fraction of any of those rates.

Why is my API bill higher than I expected?

Almost always input token volume, not output. Chat history, system prompts, and tool schemas get resent and rebilled on every call, so a session that grows from 500 to 5,000 tokens of context is paying for that growth on every later turn. Retries after a timeout and per-call media pricing are the other two usual suspects.

Do cheaper models like DeepSeek or GLM actually work for production traffic?

For a large share of requests, yes: classification, summarization, short replies, and routine tool calls rarely need frontier-level reasoning. The practical pattern is routing by task, sending the demanding minority of requests to a flagship model and everything else to a budget tier, rather than picking one model for the whole app.

What is the cheapest way to call GPT, Claude, and Gemini-class models through one API?

APIsRouter is an OpenAI-compatible gateway with pay-as-you-go billing and no subscription: global models such as GPT and Claude are priced 20% below official list, Chinese-developed models like DeepSeek and GLM sit below their own official rates, the first top-up adds a 100% balance bonus, and the /topup checkout takes payment first and emails the key with no signup form.

Does prompt caching actually lower the bill?

Where it is supported, yes, and by a lot: a cached input read commonly bills at around a tenth of the fresh input rate. It only pays off when the same prefix gets reused across multiple calls, though; caching a prompt you will only send once just adds a write premium with nothing to amortize it against.