LLM token cost estimation starts with one user task and every model call it triggers. An application that sends a prompt, calls a search tool, then sends the search results back to the model may incur two model charges and a separate search charge. A useful budget counts the whole task and keeps the assumptions visible so you can update them when traffic, prompts or prices change.
Count what each call sends and receives
For input, include system instructions, user text, conversation history, tool definitions and any retrieved material passed to the model. The second call may repeat much of the first prompt and add the tool results. Images, documents and other supported inputs can have provider-specific accounting. Use the provider’s counting endpoint or tokenizer for a representative request before launch, and compare your estimate with the usage fields returned during a pilot. Anthropic’s token-counting guide.
For output, start with measured usage from representative tasks. A configured output limit is a ceiling, while the average depends on what people ask the system to do. Check whether the model bills any reasoning tokens as output. The visible answer alone can understate the amount used. Store the rate card date, model identifier and usage categories together so the estimate can be reproduced later.
Turn each usage category into a charge
For a rate quoted per million tokens, multiply the count by the rate and divide by 1,000,000. Sum the categories for each call. Separate regular input, cache writes, cache reads and output where the provider bills them differently. Use the usage fields as documented so you do not count a cached token twice. Add any tool, hosting or session charge that the price sheet lists separately. Anthropic’s pricing documentation.
Worked example with fictional rates
Assume $2 per million regular input tokens and $8 per million output tokens. A first call sends 2,000 input tokens and returns 250 output tokens, including a tool request. The follow-up sends 3,000 input tokens and returns 500 output tokens. Together that is 5,000 input tokens and 750 output tokens. The model charge is $0.010 plus $0.006, or $0.016. A fictional $0.003 search charge brings the task to $0.019 before retries.
Now assume that 10% of tasks repeat the follow-up call once and that each repeat uses the same tokens as that call. The repeat costs $0.006 for input plus $0.004 for output. Spread over all tasks, retries add $0.001 per task. The expected cost is $0.020. This assumes the retry does not rerun search. If the search is repeated too, add that charge to the retry.
| Scenario | Tasks per month | Assumed cost per task | Monthly estimate |
|---|---|---|---|
| Low | 10,000 | $0.018 | $180 |
| Base | 25,000 | $0.020 | $500 |
| High | 40,000 | $0.027 | $1,080 |
The low case could represent shorter requests and fewer retries. The high case allows for more long requests and more follow-up calls. Use those scenario values as placeholders until logs show how tasks actually differ. If you group tasks into classes, project each class separately and add the totals. A small share of long document tasks may account for a large share of spend even when most interactions are short.
Model cache usage as a mix of hits and writes
For a shared prompt prefix, track how often it is written, read, or sent as regular input. An application with bursts of similar requests may see a different mix from an application with hours between calls. Put those counts in separate columns and apply their own rates. Measure the hit rate during the hours users actually send requests, especially if the shared prefix changes with each tenant or product version.
Compare the forecast with real usage
Log one row per call with the task ID, model, usage categories and whether it was a retry. Record tool charges with the same task ID so they are easy to reconcile. Compare the resulting estimate with provider reporting on the same dates. If the totals differ, check cache fields, failed or cancelled attempts, model routing and time zones before changing the budget.
Track cost per completed task alongside total spend. A change that makes a single call cheaper can still increase the cost of completion if the workflow needs more follow-up calls. Measure answer quality and retry rate in the same pilot. For workflows that pause before a consequential action, count proposal generation and any new model calls after review separately. See the guide to AI agent human approval.

