Prompt Cost Estimator: The Formula, Worked
The cost of one call is input tokens divided by one million, times the input rate, plus output tokens divided by one million, times the output rate. Multiply by calls per day and by 30.44 for a monthly figure. Because output is typically priced several times higher than input, the reply length usually dominates the bill on short prompts.
The formula and why output dominates
Per-call cost equals input tokens over one million times the input rate, plus output tokens over one million times the output rate. On most published price sheets the output rate is three to five times the input rate, so a short prompt with a long answer costs more than a long document with a short summary.
That inverts the intuition most people bring. Optimising prompt length helps, but capping reply length and stopping generation early helps more whenever the answer is allowed to be short.
Worked examples
A 1,500-token prompt with a 500-token reply, at $3 input and $15 output per million: input costs $0.0045 and output costs $0.0075, so $0.012 per call. At 1,000 calls a day that is $12 a day, about $365 a month.
Hold the input fixed and double the reply to 1,000 tokens: output alone becomes $0.015 and the call is $0.0195, a 62 percent rise for the same prompt. That is the lever worth pulling first.
Where estimates go wrong
Three things push real spend above the estimate: hidden system prompts and tool schemas, retries and failed calls that are still billed, and caching that is assumed but not actually enabled.
Measure one real call end to end, including the system prompt and tool schema, then scale. An estimate built from the user message alone typically undercounts by a wide margin.
Reconciling the estimate against a real invoice
An estimate built from the formula is a planning number, not a bill. Reconcile once: take a single day of real usage, multiply measured per-call cost by the actual call count, and compare against the provider invoice line for that day. If the two disagree by more than a few percent, the gap is almost always retries, a longer system prompt than assumed, or output that ran to the token cap.
Store the measured ratio next to the estimate. Once a workload has a measured ratio, every future estimate for that workload is simply measured cost times volume, which is far more reliable than re-deriving it from token counts each time.
Per-call cost at $3 input / $15 output per million tokens
| Input tokens | Output tokens | Input cost | Output cost | Per call |
|---|---|---|---|---|
| 500 | 200 | $0.0015 | $0.0030 | $0.0045 |
| 1,500 | 500 | $0.0045 | $0.0075 | $0.0120 |
| 1,500 | 1,000 | $0.0045 | $0.0150 | $0.0195 |
| 8,000 | 1,000 | $0.0240 | $0.0150 | $0.0390 |
| 30,000 | 1,000 | $0.0900 | $0.0150 | $0.1050 |
Monthly cost at 1,000 calls per day
| Per-call cost | Per day | Per month | Per year |
|---|---|---|---|
| $0.0045 | $4.50 | $137 | $1,644 |
| $0.0120 | $12.00 | $365 | $4,383 |
| $0.0195 | $19.50 | $594 | $7,123 |
| $0.0390 | $39.00 | $1,187 | $14,247 |
| $0.1050 | $105.00 | $3,196 | $38,355 |
What moves the bill most
| Lever | Effect | Effort |
|---|---|---|
| Cap reply length | High — output is priced highest | Low |
| Trim retrieved context | Medium to high on RAG workloads | Medium |
| Prompt caching | High when the same prefix repeats | Medium |
| Cheaper lane for tolerant work | High, and usually the quickest win | Low |
Frequently asked questions
Is the estimate exact?
No. It is arithmetic on rates you supply. Real bills differ through retries, caching behaviour, and cached-versus-uncached rates, so treat the output as a planning figure and reconcile against one real invoice.
Should I optimise prompt or reply length?
Reply length first, unless your prompts are very large. Output is priced several times higher than input on most price sheets, so a shorter answer saves more per token removed.
How do retries affect the estimate?
Every retry is another billed call, so a workload that retries once on ten percent of requests costs about ten percent more than the formula suggests. Instrument retry counts before trusting any per-call estimate.
More in tools
Sources and read dates
- Riven pricing - plans, credits and pay-as-you-go base rate (read 2026-11-26)
- Riven models - lane list and per-lane multipliers (read 2026-11-26)
- Anthropic pricing - Claude Pro, Max, Team and per-token API rates (read 2026-11-26)
- OpenAI API pricing - per-model token rates (read 2026-11-26)