The formula
Tokens are priced per million, so 5,000 input tokens at $2/1M is 0.005 × $2 = $0.01. The arithmetic is trivial; the hard part is the extras — the line items that do not appear in the headline rate.
The five line items everyone forgets
- Thinking tokens. On reasoning models, hidden chain-of-thought bills at output rates. Budget it separately — it can exceed the visible answer 10× over. See our reasoning cost guide.
- Cache writes. OpenAI charges 1.25× the input rate to write a cache entry (GPT-6.1 Sol: $2.50/1M). Writes are cheap because they happen once; forgetting them makes your first estimate look wrong on day one.
- Long-context bands. Cross the threshold and the whole request re-prices — GPT-6.1 Sol jumps from $2/$10 to $4/$15, Grok 4.7 from $2/$6 to $4/$12. Model your longest prompts, not your average ones.
- Peak-hour pricing. DeepSeek doubles rates during weekday peak windows (01:00–04:00 and 06:00–10:00 UTC, excluding Chinese public holidays). Schedule bulk jobs outside them.
- Tool calls and storage. Built-in tools have their own meters — OpenAI's file search is $2.50 per 1,000 calls plus $0.10/GB-day storage, and web search is $10 per 1,000 calls. Agents that search the web can spend more on tool calls than on tokens.
Three worked examples
1. Customer-support chatbot on GPT-6.1 Sol
Input: 0.003 × (0.2 × $2 + 0.8 × $0.10) = $0.00144 per chat
Output: 0.0004 × $10 = $0.004 per chat · Total ≈ $0.0054/chat → ~$815/month
2. Coding agent on Grok 4.7
0.04 × $2 + 0.008 × $6 = $0.128 per task → ~$1,920/month
Stay under the 200K-token band — one long session crossing it doubles that task's tokens.
3. Nightly document pipeline on DeepSeek V4.1 Flash
2 × (0.1 × $0.15 + 0.9 × $0.003) + 0.2 × $0.60 = $0.155/night → ~$4.70/month
Quick calculator
Plug in your own numbers. Rates are the verified October 2026 list rates; caching assumes an 80% cache-hit rate on input.
Re-estimate at every scale-up
Estimates drift because workloads change shape: agents add thinking tokens, prompts grow past band thresholds, and cache-hit rates fall as prompt variety grows. Re-run the math before each scale-up, and set a billing alert at 130% of the estimate. For the full rate card behind these numbers, see the pricing dashboard.
Quick answers
What is the formula for estimating LLM API cost?
Monthly bill = requests/day × 30 × [(input tokens × input rate) + (output tokens × output rate) + extras]. The extras — thinking tokens, cache writes, long-context bands, peak-hour pricing, and tool calls — are where most estimates go wrong.
How much does 1,000 API requests cost?
It depends entirely on tokens per request. At 5,000 input + 800 output tokens on GPT-6.1 Sol ($2/$10), 1,000 requests cost about $18. The same request shape on DeepSeek V4.1 Flash off-peak costs under $0.20. Use the calculator above with your own token counts for a real number.
Why is my actual bill higher than my estimate?
The usual culprits: hidden reasoning tokens billed at output rates, prompts crossing long-context band thresholds so the whole request re-prices, tool-call charges like web search at $10/1K calls on OpenAI, cache writes at 1.25x input, and peak-hour surcharges on DeepSeek. The formula is easy; the forgotten line items are not.
Should I use average or peak token counts in estimates?
Model your longest prompts, not your average ones. Long-context band thresholds re-price the entire request once crossed, so one 250K-token session can cost more than ten 25K-token sessions combined. Averages hide exactly the requests that dominate real bills — plan around the expensive tail, not the typical case.