Every team building on language models eventually asks the same blunt question: what is the least I can pay per request without shipping something worse? An AI API is a hosted HTTP endpoint that accepts a prompt and returns model-generated tokens, billed per million tokens of input and output rather than per seat or per month. That billing unit is why the gap between the priciest and thriftiest option runs past a hundredfold. Stanford HAI’s AI Index found that querying a model at GPT-3.5-level quality fell from $20 to $0.07 per million tokens between November 2022 and October 2024 — roughly a 280-fold drop in under two years. That collapse has not stopped.
Disclosure: some links in this guide are affiliate links, and we may earn a commission if you sign up through them at no extra cost to you. Rankings reflect published rates and our own testing, never commissions.
| Quick answer: The cheapest AI API from a major lab is OpenAI’s gpt-5-nano at $0.05 per million input tokens and $0.40 output. DeepSeek-V4-Flash is the cheapest frontier-class option at $0.14 input and $0.28 output. But routing, prompt caching and batch endpoints cut real bills by 60–90%, which matters far more than picking the lowest sticker price. |

Table of Contents
What is the cheapest AI API in 2026?
By published list price, the cheapest AI API from a top-tier lab is OpenAI’s gpt-5-nano, which costs $0.05 per million input tokens and $0.40 per million output tokens according to OpenAI’s pricing documentation. Cached input on the same model drops to $0.005 per million tokens, or half a cent.
Cheap is not the same as capable, though. The more useful benchmark is the cheapest model that can still do serious work, and that title currently belongs to DeepSeek-V4-Flash at $0.14 input and $0.28 output per million tokens, with a one-million-token context window and cache-hit input priced at $0.0028 per million, per DeepSeek’s official pricing page. A frontier model like Claude Opus 5 costs $5 input and $25 output — roughly 36 times the input price and 89 times the output price of DeepSeek-V4-Flash.
Those two numbers frame the decision. If your workload is classification, extraction, summarisation or routing, the nano and flash tiers will almost certainly hold up. If it involves multi-step reasoning, agentic tool loops or code that has to be right first time, the premium tier earns its multiple. Most production systems need both. For a fuller view of what each provider offers beyond price, see our guide to the best AI API for developers.
How does AI API pricing actually work?
A token is a subword unit of roughly four English characters, or about three-quarters of a word, so a 1,000-word document is around 1,300 tokens. Providers bill input and output separately, and output almost always costs more — typically four to five times more. Claude Opus 5 charges $5 in and $25 out; gpt-5-nano charges $0.05 in and $0.40 out. That asymmetry exists because generating tokens is sequential and cannot be batched the way prompt processing can.
Three modifiers sit on top of the base rate, and this is where most savings live. Cache reads bill at a fraction of standard input: Anthropic prices a cache hit at 0.1x the base input rate, and OpenAI applies a comparable 90% discount on cached input. Batch endpoints, which process requests asynchronously within a few hours, cut both input and output by 50% at OpenAI, Google and Anthropic alike.
The practical consequence is that two teams running identical traffic on identical models can see bills that differ by an order of magnitude, purely from architecture. Sticker price is the starting point, not the answer.
Which budget models cost least per million tokens?
The table below shows verified July 2026 list prices per million tokens, ordered from cheapest input upward. All figures come from each provider’s own published pricing page.
| Model | Input / output per 1M tokens | Best suited to |
| gpt-5-nano | $0.05 / $0.40 | High-volume classification and extraction |
| DeepSeek-V4-Flash | $0.14 / $0.28 | Cheapest frontier-class quality, 1M context |
| Gemini 3.1 Flash-Lite | $0.25 / $1.50 | Bulk multimodal and long-document work |
| Claude Haiku 4.5 | $1.00 / $5.00 | Budget tier with reliable tool use |
| Claude Sonnet 5 | $2.00 / $10.00 | Mid-tier value (introductory rate to 31 Aug 2026) |
| Claude Opus 5 | $5.00 / $25.00 | The hardest 10% of reasoning and agent work |

Two details are easy to miss. Gemini 3.1 Flash-Lite looks expensive next to DeepSeek on output, but Google’s batch pricing halves it, and its multimodal input beats any text-only model for image or video pipelines. And Claude Sonnet 5 sits at $2 input only until 31 August 2026, after which it moves to $3 — a scheduled increase worth budgeting for now rather than discovering in September. Quality varies far more than price alone suggests, so pair this table with our pillar on the best AI models available today.
Are there genuinely free AI APIs?
Yes, with real caveats. Google AI Studio offers a free tier with zero-cost input and output tokens on selected Gemini models, but Google’s own documentation states that free-tier content is used to improve its products — which rules it out for confidential work. OpenRouter aggregates a rotating set of free-to-call models behind one endpoint, subject to per-minute and per-day caps that suit prototyping, not production.
The third free path is self-hosting open-weight models, where you pay only for hardware or GPU rental instead of per token. At sustained high volume, or where data cannot leave your infrastructure, this frequently beats every hosted rate — though you absorb the operations burden and the idle-capacity cost. Our guide to the best open source LLM options for self-hosting covers which weights are worth the trouble.
A sensible pattern is to prototype free, measure quality against a paid model, then upgrade before rate limits become the thing your users notice.
How do you cut AI API costs by 60–90%?

Tiered routing is the largest single lever. Most applications receive a mix of trivial and hard requests; sending the easy majority to a nano or flash model, the middle to a mid-tier model, and only the genuinely hard minority to a frontier model typically removes 60–80% of spend with minimal quality loss. A short classifier, or even length and keyword heuristics, is enough to decide.
Four tactics compound on top of routing. Cache aggressively, because repeated system prompts and documents bill at roughly a tenth of standard input once cached. Move anything that is not user-facing to a batch endpoint for a flat 50% cut. Trim prompts and cap maximum output length, since both sides of the meter respond immediately. And enable extended reasoning only for tasks that measurably benefit, because reasoning tokens are billed as output at the highest rate on the card.
Track spend per feature, not per month. A single invoice hides which endpoint is burning the budget; per-feature attribution turns cost control into a ranked list.
How we compare
We take every price here directly from the provider’s official pricing documentation rather than from aggregator sites, and re-verify before each update — this edition was checked in July 2026. We quote standard on-demand rates, not enterprise pricing, and list batch and cache discounts separately rather than folding them into headline numbers. Where a rate is scheduled to change, we give the date. We do not accept payment for placement in comparison tables.
A worked example: a $4,500 bill cut to $522
Priya Raghavan runs a two-person document-summarisation SaaS serving legal teams. Her workload is 400 million input and 100 million output tokens a month, and she started by sending all of it to Claude Opus 5 because early quality tests favoured it. At $5 input and $25 output, that is $2,000 plus $2,500 — a $4,500 monthly bill on a product billing $9,000.
She spent a weekend adding a routing layer. Document length and a simple complexity score now send 75% of requests to DeepSeek-V4-Flash, 15% to Claude Haiku 4.5, and the remaining 10% — contract analysis and anything flagged ambiguous — to Claude Opus 5. The cheap tier costs $63 a month, Haiku adds $135, the Opus slice $450: $648 in total. Prompt caching on the Opus path, where roughly 70% of input is a repeated instruction block, trimmed that slice from $200 to $74.
Her bill landed at $522 a month, an 88% reduction, and a blind quality review found no user-visible regression on the routed traffic. The decisive move was not finding a cheaper model; it was recognising that only a tenth of her traffic ever needed the expensive one. Choosing which model sits in each tier is the harder half of the work, and our comparison of the best AI models by task type is where to start.
Frequently Asked Questions
What is the cheapest AI API right now?
OpenAI’s gpt-5-nano is the cheapest API from a major lab at $0.05 per million input tokens and $0.40 output. DeepSeek-V4-Flash is the cheapest frontier-class option at $0.14 and $0.28. Prices change frequently, so confirm current rates on each provider’s official pricing page before committing.
Is DeepSeek cheaper than OpenAI?
It depends on the tier. DeepSeek-V4-Flash costs $0.14 input and $0.28 output per million tokens, which undercuts OpenAI’s mid-range models heavily but is dearer on input than gpt-5-nano at $0.05. Against frontier models from either lab, DeepSeek is dramatically cheaper on both sides of the meter.
Can I use an AI API for free?
Yes. Google AI Studio provides a free Gemini tier with zero-cost tokens, and OpenRouter exposes a rotating set of free models under request caps. Both suit prototyping rather than production. Google notes that free-tier content may be used to improve its products, so avoid it for confidential data.
Why do output tokens cost more than input tokens?
Output generation is sequential: each token depends on the one before it, so it cannot be parallelised the way prompt processing can. That makes generation far more expensive in GPU time. Most providers price output four to five times higher than input, which is why capping response length cuts bills quickly.
Does prompt caching really cut costs by 90%?
On the cached portion, close to it. Anthropic bills a cache hit at 0.1x its base input rate, and OpenAI applies a similar 90% discount to cached input. The saving applies only to repeated context, so it is largest for agents and chat systems that resend the same system prompt on every call.
Is self-hosting an open-weight model cheaper than an API?
Only above a certain volume. Self-hosting replaces per-token billing with fixed GPU cost, so it wins when utilisation stays high or when data cannot leave your infrastructure. At low or spiky volume, budget hosted models are almost always cheaper once engineering and idle capacity are counted.
Conclusion
The cheapest sticker price in July 2026 belongs to gpt-5-nano at $0.05 per million input tokens, and the cheapest genuinely capable option is DeepSeek-V4-Flash at $0.14 and $0.28. Those numbers are worth knowing. They are also, for most teams, the least important part of the answer. Priya’s bill fell 88% not because she found a cheaper model but because she stopped sending easy work to an expensive one, then cached the context she was re-paying for on every call. Measure which requests genuinely need frontier reasoning, route the rest downward, turn on caching and batch where latency allows, and verify every rate at the source — in a market that fell 280-fold in two years, today’s cheapest option is unlikely to be next quarter’s.

