LLM API pricing looks simple until the invoice arrives. Two models with similar quality can differ fivefold in cost, and the same model can cost ten times more depending on how you call it. Token pricing is only the headline number.

This guide breaks down real published rates across the major providers, explains the mechanics that move your bill, and shows how to estimate cost before you write code. All figures are published list prices per million tokens and should be rechecked before any budget commitment, since providers adjust them frequently.
How LLM Pricing Actually Works
Every provider charges by token, and almost all split the charge three ways.
Input tokens are what you send. Prompt, system instructions, retrieved documents, conversation history, all of it.
Output tokens are what the model generates. Output almost always costs more than input, typically two to five times as much, because generation is sequential and slower.
Cached input tokens get a discount when the same prefix repeats. If your system prompt and few-shot examples stay identical across requests, providers serve that prefix from cache at a fraction of normal input rates.
Some providers add separate tiers. Long context pricing charges more once a prompt crosses a threshold, because attention cost grows with sequence length. Batch processing costs less, often half price, in exchange for delayed responses.
The practical rule: your bill is driven far more by prompt size and output length than by how many requests you make. One 50,000 token retrieval prompt costs more than a hundred short chat turns.
Published List Prices Across Major Providers
Prices move, so treat these as a structural comparison rather than a fixed quote.
Frontier premium models sit at the top tier. OpenAI’s GPT-4 class and Anthropic’s Claude Opus class historically price around 10 to 15 dollars per million input tokens and 40 to 75 dollars per million output tokens. These are the strongest models and the most expensive per call.
Mid tier general models are the workhorses. GPT-4o class and Claude Sonnet class models have generally listed around 2 to 5 dollars per million input and 10 to 15 dollars per million output. Most production traffic lands here.
Lightweight and fast models drop sharply. GPT-4o mini, Gemini Flash, and Claude Haiku class models list in the range of 0.10 to 0.60 dollars per million input and 0.40 to 2.50 dollars per million output. For classification, routing, and simple chat, these are often the correct default.
Open hosted models vary by size. Mid size open models on specialist providers commonly list between 0.20 and 0.90 dollars per million input, with large mixture of experts models higher. Self hosting changes the math entirely, replacing per token pricing with fixed GPU cost.
Reasoning models carry a premium. Models that generate long internal chains charge for that thinking as output tokens. A reasoning model can produce thousands of hidden or visible reasoning tokens per answer, so effective cost per useful answer is multiples of the sticker price.
The Seven Cost Drivers Nobody Prices In
Output length
The single biggest lever. Doubling answer length doubles output cost, and output is already the expensive side. Tighten max output tokens, ask for concise answers, and trim chatty system prompts.
Prompt bloat
System prompts grow over time as teams pile on instructions, safety rules, and examples. A 3,000 token system prompt on every call is a permanent tax. Periodically audit and compress it.
Conversation history
Multi-turn products resend the entire history each turn. Without trimming, cost grows quadratically with conversation length over the life of a session. Summarize old turns, cap history, or move to models with discounted long context.
Retrieval volume
RAG systems that stuff ten chunks into every prompt pay for those tokens on every call. Retrieval quality matters financially: returning three relevant chunks beats ten vague ones in both cost and answer quality.
Retry and failure loops
Failed parses, format violations, and safety retries multiply calls. Every retry is a full priced request. Structured output modes and better prompting cut this hidden multiplier.
Model over-selection
Using a frontier reasoning model to extract fields from a form is paying for a Formula 1 car to do errands. Route simple tasks to cheap models and reserve premium models for genuinely hard work.
Long context surcharges
Some providers price tokens above a threshold higher, for example above 128K or 200K tokens. A 180,000 token prompt can cost noticeably more per token than an 80,000 token one on the same model.
Caching: The Discount Most Teams Ignore
Prompt caching is the easiest savings available. Providers like OpenAI, Anthropic, and Google offer automatic caching where repeated prefixes are served at a discount, commonly 50 to 90 percent off normal input rates for cached tokens.
The condition is prefix stability. Your system prompt, tool definitions, and few-shot examples must appear identically at the start of every request. Any change invalidates the cache from that point.
Practical steps: put static content first, keep dynamic content last, avoid timestamps or IDs near the top of prompts, and keep tool schemas in a fixed order. Done well, caching alone can cut input costs by a third or more on chat workloads.
Batch API: Half Price for Non Urgent Work
If a workload can tolerate minutes or hours of delay, batch endpoints typically price at 50 percent of interactive rates. Summarization, embeddings for new documents, evaluation runs, content classification, and backfills all fit.
The tradeoff is latency and some operational overhead. For any background pipeline, the discount is usually worth taking automatically.
Estimating Cost Before You Build
A simple model gets you close enough for budgeting.
Take average input tokens per request, multiply by input price per million. Take average output tokens, multiply by output price. Add them, multiply by expected requests per day, then by 30.
Example: a support assistant sends 4,000 input tokens and generates 600 output tokens per turn on a mid tier model priced at 3 dollars input and 15 dollars output per million.
Input cost per turn: 4,000 divided by 1,000,000, times 3, equals 0.012 dollars.
Output cost per turn: 600 divided by 1,000,000, times 15, equals 0.009 dollars.
Total per turn: 0.021 dollars, about 2.1 cents. At 10,000 turns a day, that is roughly 210 dollars a day, or around 6,300 dollars a month.
That estimate ignores caching and retries. Real bills land lower with caching and higher with failures, so measure early and adjust.
Model Selection by Task Type
Classification and routing tasks almost never need a frontier model. A lightweight model with a clear label list handles intent detection, spam filtering, and tag assignment at a tiny fraction of the cost. This is the highest leverage place to downgrade.
Structured extraction works well on mid tier models when the schema is explicit. Reserve premium models for messy documents where ambiguity is high.
Summarization scales with input size. Since input dominates, cheaper models with large context windows are usually the right choice here.
Coding assistance benefits from stronger models, but autocomplete and completion style traffic, high volume and short lived, can often use smaller specialized models.
Hard reasoning, multi step analysis, and complex agentic planning are where premium pricing buys real quality. Use them deliberately, not by default.
The Router Pattern: Cheap First, Expensive Fallback
Sophisticated teams rarely use one model for everything. They route.
A common architecture sends every request to a fast, cheap model first. If the response passes validation, format checks, confidence scoring, or a lightweight judge, it ships. Failures escalate to a stronger model.
This inverts the typical cost curve. Most traffic runs on the cheap tier, and expensive calls become the exception. Teams report effective cost reductions of 50 to 80 percent with minimal quality loss, because the easy cases, which dominate volume, never touch the premium tier.
More advanced setups use a small model to judge whether the answer is likely correct, and only escalate on doubt. The key requirement is a measurable validation step. Without one, routing just adds latency.
Open Source and Self Hosted: The Real Math
Self hosting replaces per token pricing with fixed hardware cost. The economics favor steady, high utilization.
A rough framework: take the GPU hourly rate, divide by tokens per hour your serving stack can produce, to get your effective per million token cost. A single high end GPU serving a mid size quantized model might process millions of tokens per hour, producing costs competitive with or below hosted open model pricing, and far below frontier rates.
The caveats are utilization, engineering time, and idle capacity. If traffic is spiky, you pay for GPUs that sit idle. If nobody on the team wants to run serving infrastructure, hosted is cheaper than the hidden labor.
For most early stage products, hosted APIs win until volume is large and predictable. For established products with steady load, self hosting becomes a real savings line.
Practical Cost Reduction Checklist
Compress system prompts and keep static content first for caching.
Cap output tokens to what the task actually needs.
Set conversation history limits and summarize older turns.
Route simple tasks to cheap models with a validation step.
Use batch APIs for anything non urgent.
Audit retries and fix format failures at the source.
Right size retrieval: fewer, more relevant chunks.
Review pricing pages quarterly; prices fall faster than teams renegotiate.
Track cost per task, not just total spend, so regressions are visible.
Forecasting: What Changes the Bill Next
Three trends shape pricing going down.
Inference efficiency keeps improving. New hardware and serving techniques push prices down steadily; providers have historically cut prices repeatedly rather than raising them.
Caching and batching become more automatic, rewarding well structured prompts.
Model differentiation widens the spread. Premium reasoning models get more expensive relative to lightweight ones as capability gaps grow, which makes routing more valuable over time.
The winning habit is instrumenting cost per request type from day one. Teams that measure can optimize; teams that only see the monthly total cannot tell which feature is expensive.
The Bottom Line
LLM pricing is not a mystery. It is output length, prompt size, model choice, and discipline. Pick the cheapest model that passes your evaluation, keep prompts lean and cacheable, batch what can wait, and route hard problems to expensive models only when validation says they are needed.
Do those things and the bill becomes predictable. Skip them and the same product can cost five times more than an identical one built by a team that measured.
Key Takeaways on LLM API pricing
Good LLM API pricing starts with a golden set of real examples you trust. The point of LLM API pricing is to catch regressions before your users do. Whatever your LLM API pricing workflow looks like, keep it repeatable and logged. Treat LLM API pricing as part of the product, not a one-off test. Consistent LLM API pricing habits separate reliable systems from lucky demos.
Related reading on The LLM News: LLM Tools | LLM Use Cases | LM Arena AI Leaderboard
Source: Large language model – Wikipedia | OpenAI – Wikipedia