How the LLM API cost formula works
Providers such as OpenAI, Anthropic, and Google Gemini typically bill input and output tokens on separate per-million rates. MetricTray’s calculator mirrors the invoice math finance teams actually reconcile:
monthly = (inputTokens / 1,000,000 × inputPrice) + (outputTokens / 1,000,000 × outputPrice)
Input tokens cover prompts, retrieved context, chat history, tool schemas, and evaluation harness traffic. Output tokens cover model completions—including retries, JSON repairs, and multi-step agent loops. Because output rates are often 3–5× input rates, verbose answers dominate invoices even when prompt size looks modest. Always multiply per-request tokens by realistic daily volume and billable days rather than annualizing a quiet prototype week.
Presets in the widget above ship with illustrative USD list prices so US startups can budget quickly. UK, Canadian, and Australian teams should keep the same token math, then convert with their finance FX rate and confirm VAT or GST treatment with accounting—the calculator intentionally stays currency-agnostic at the rate fields so you can paste localized unit prices when needed.
Worked example: US SaaS support desk
A US customer-support product averages 5,000 assists/day, 1,200 input tokens, and 400 output tokens on GPT-4o list pricing ($2.50 / $10 per million). Over 30 days that is roughly 150,000 requests, 180M input tokens, and 60M output tokens—about $450 input + $600 output = $1,050/month before enterprise discounts. Doubling daily volume pushes the same feature near $2,100/month, which is why the calculator surfaces 2× and 5× stress cases for runway planning and pricing conversations with customers who want “unlimited AI support.”
If 15% of assists retry once because of malformed tool calls, treat that as extra completion volume—not a rounding error. US teams that ignore retries often under-forecast by 10–25% and then scramble when the first month of GA traffic lands.
Worked example: UK content operations
A London editorial team drafts 800 briefs/day with Gemini Flash. At 2,200 input tokens and 700 output tokens, monthly volume lands near 52.8M input and 16.8M output tokens. Using illustrative Flash rates ($0.075 / $0.30), the estimate is only tens of dollars—until the team upgrades rejected drafts to a premium model. Routing 20% of jobs to a Sonnet-class model can multiply spend overnight, so UK finance teams should model the blended mix, then convert USD list prices with their FX and VAT assumptions before presenting a board pack.
A practical control: generate outlines on the cheap model first, then expand only editor-approved outlines. That two-stage workflow removes thousands of unused completion tokens on days when topic selection is picky—common for UK newsroom and agency calendars.
Practical tips before you ship
- Cap `max_tokens` to the UI surface area users actually read.
- Cache stable system prompts and retrieved handbooks.
- Route FAQ traffic to cheaper models; escalate edge cases only.
- Tag every request with feature, model, and environment.
- Reconcile calculator forecasts against invoices monthly.
Treat this page as a living budget instrument: update rates when providers publish new list prices, keep a gold evaluation set so quality does not silently collapse after a model downgrade, and share the 5× stress figure with product leadership before launching a “chat with your data” surface to every seat.
For the full optimization playbook, read the paired guide on how to reduce LLM API costs.