Per-token pricing puts all three models in the same ballpark—roughly a fraction of a dollar per million input tokens and a few dollars per million output tokens—so the cheapest choice depends on your input-to-output ratio, context length, and how much you can cache. For most small-model workloads, Gemini Flash and GPT-4o mini tend to be the low-cost leaders on input, while Claude Haiku sits somewhat higher but stays competitive once prompt caching kicks in. Output tokens cost several times more than input tokens across all three, so generation-heavy workloads deserve the most scrutiny.
The Small-Model Cost Landscape
"Small models" here means the lightweight tier each vendor sells as a cheaper, faster alternative to its flagship: GPT-4o mini from OpenAI, Claude Haiku from Anthropic, and Gemini Flash from Google. All three are priced per token, where a token is a chunk of text roughly three-quarters of a word in English. Vendors quote prices per million tokens, which makes the numbers look tiny—often under a dollar for input—but real bills come from multiplying those rates by the millions of tokens a production app moves.
The structural pattern is consistent: input tokens (what you send) are cheap, output tokens (what the model generates) cost several times more. That asymmetry exists because generation is computationally heavier than reading a prompt. A rough rule of thumb across this tier is that output costs roughly three to five times input, an estimate derived from typical published ratios rather than any single benchmark.
Three variables move the final number more than the headline rate: the ratio of input to output tokens in your workload, how long your prompts are (long-context requests can be priced higher per token), and whether you reuse prompts often enough to benefit from caching. A model that looks 20% cheaper per token can lose that advantage if it needs longer prompts or produces more verbose answers to reach the same quality.
Input vs Output Token Pricing Compared
Rather than quote exact figures that change frequently, compare the three on structure. All charge separately for input and output, all bill per million tokens, and all publish tiered or promotional rates from time to time—so verify current numbers on each vendor's pricing page before budgeting. What stays stable is the relative shape: input rates cluster in the sub-dollar-per-million range, and output rates land in the low single digits per million.
For a concrete estimate, assume input at roughly $0.10–$0.50 per million tokens and output at roughly $0.40–$2.00 per million across this tier. Those are reasoned ranges, not quotes. Plug in your own traffic: a support bot handling 10 million input tokens and 2 million output tokens per month would cost, at the midpoint of those ranges, on the order of a few dollars—trivial. Scale to 1 billion input tokens and the same math produces hundreds of dollars, which is where model choice starts to matter.
The practical takeaway: if your workload is input-heavy (long documents, retrieval-augmented prompts, classification), the input rate dominates and the cheapest-input model wins. If it is output-heavy (summaries, chat replies, code generation), the output rate dominates, and a model with a slightly higher input price but leaner output can come out ahead. Always compute both sides before picking.
Context Windows, Caching and Hidden Costs
The headline price per million tokens hides three things that often matter more: how many tokens fit in one request, whether repeated prompt text can be cached, and what you pay for reasoning or structured output.
Context window is the maximum number of tokens (word fragments; roughly 0.75 words per token in English) a model can read and write in a single call. A larger window lets you paste whole documents, but it also raises the risk of paying for the same long prompt on every request. For repeated workloads, caching is the lever.
Prompt caching (also called KV-cache reuse) stores the processed form of a fixed prefix — a system prompt, a long instruction block, a reference document — so later calls reuse it instead of reprocessing it. Providers typically charge a reduced rate for cached input tokens and a one-time write cost. Exact rates change, so verify them on each provider's pricing page; the pattern to expect is cached input at a fraction of normal input, with a small surcharge on first write.
Hidden costs to watch:
- Reasoning or "thinking" tokens are often billed as output tokens even though you may not display them.
- Structured output and tool calls add output tokens.
- Very long inputs can trigger higher pricing tiers on some providers.
- Retries, failed calls and streaming overhead still consume tokens.
Estimating Real Workload Costs with the LLM API Cost Calculator
Use a calculator that takes four inputs: input tokens per request, output tokens per request, requests per month, and cache hit rate. The core formula:
monthly_cost = requests × [ input_tokens × input_price × (1 - cache_hit_rate)
+ input_tokens × cached_price × cache_hit_rate
+ output_tokens × output_price ]
Prices are per token, so divide per-million rates by 1,000,000.
Worked example (illustrative prices, not quoted rates). Assume input at $0.15 per million tokens, output at $0.60 per million, cached input at $0.03 per million. A support bot sends 4,000 input tokens and 300 output tokens per request, 50,000 requests per month, with a 70% cache hit rate.
- Fresh input: 4,000 × 0.15 / 1e6 = $0.0006 per request
- Cached input: 4,000 × 0.03 / 1e6 = $0.00012
- Blended input: 0.0006 × 0.30 + 0.00012 × 0.70 = $0.00018 + $0.000084 = $0.000264
- Output: 300 × 0.60 / 1e6 = $0.00018
- Per request: $0.000444
- Monthly: 50,000 × 0.000444 = $22.20 (versus $30.00 with no caching)
Checklist before deploying:
- Measure real input/output token counts on a sample of traffic.
- Confirm each provider's current per-million rates, including cached and reasoning tokens.
- Estimate cache hit rate from how repetitive your prompts are.
- Add 10–20% headroom for retries and growth.
- Re-run the estimate whenever models or prices change.
Frequently Asked Questions
How much do GPT-4o mini, Claude Haiku and Gemini Flash cost per million tokens?
None of the three vendors publishes a single flat number, because pricing differs by model generation (for example Claude 3 Haiku vs Claude 3.5 Haiku) and changes over time, so treat any figure as an estimate and check the current price page before you commit. Ballpark, as of recent published pricing: GPT-4o mini sits at roughly $0.15 per million input tokens and around $0.60 per million output tokens; Claude Haiku models generally land in the low single-digit dollars per million input and several dollars per million output (the older, cheaper Haiku tier is lower than the newer one); Gemini Flash has historically been priced in a similar low range, with a cheaper tier for shorter prompts and a higher rate above a prompt-length threshold. Because these numbers shift with promotions and new releases, always pull the live rate card for the exact model string you plan to call.
Which small model is cheapest for long-context inputs?
"Long-context" means a prompt that fills a large share of the model's context window (the maximum tokens it can read at once). For long inputs, input-token price dominates the bill, so the cheapest model is whichever charges least per input token at your prompt size, and that can flip depending on whether a provider applies a long-context surcharge above a certain threshold. Gemini Flash is often the value pick for very large inputs because of its large window and low input rate, but GPT-4o mini's low input price can win on moderately long prompts, and Claude Haiku is competitive when you also weigh output quality. The practical answer: run your actual prompt length through each model's current tiered pricing rather than trusting a single headline rate.
Do output tokens cost more than input tokens for these models?
Yes, consistently. For all three families, output tokens (the text the model generates) are priced several times higher than input tokens (the text you send), typically in the range of roughly three to five times the input rate. This matters because a chatty response or a long generated document can cost far more than the prompt that triggered it, even when the input is large. If cost is the constraint, cap max_tokens and ask for concise output before shopping for a cheaper model.
How does KV-cache and prompt caching affect the final bill?
A KV-cache (key-value cache) stores the internal attention state for tokens the model has already processed, so it does not recompute them on every call; prompt caching exposes this to you by letting a provider reuse a stable prefix (like a long system prompt or reference document) across requests at a discounted input rate. When caching is available and your workload repeats the same prefix, the effective input cost can drop meaningfully, often by a large fraction on the cached portion, while cache writes and cache reads may be billed at different rates. The catch is that caching only pays off if the prefix is long enough and reused often enough to offset any cache-storage or write fee, so short one-off prompts see little benefit.
Can I estimate my monthly API cost before deploying?
Yes, and you should. A cost calculator works by multiplying your expected input tokens and output tokens per request by the model's per-million rates (remembering output is priced higher), then scaling by requests per day and days per month; a simple formula is:
monthly_cost = (requests_per_month * input_tokens/1e6 * input_rate)
+ (requests_per_month * output_tokens/1e6 * output_rate)
Add a buffer for retries, failed calls, and any long-context surcharges, and run the same inputs across all three models to compare. Track real token counts from a sample of live calls to replace your guesses with measured averages before you scale up.