Topic 1 of 6 · 5 min read
Calculating cost per completed task
Goal: Calculate the cost per completed task for an AI feature, including retries, reasoning tokens and review time.
The cost that matters is not the price of one model call. It is the total spend, divided by the number of tasks that actually finished well. A task is the thing the customer wanted done: a ticket resolved, a contract summarised, a meeting turned into notes.
Check yourself · 1 of 3
A team computes the cost of its summary feature as input tokens plus output tokens times the price. Which cost is most likely missing?
Why it matters
A price list shows dollars per million tokens. A manager reading that number sees a feature that costs fractions of a cent. The real feature makes several calls, retries some of them, and sometimes fails. Budgets, prices and margins built on the list price come out wrong, usually too low.
How to do it
Work in five steps, for one task type at a time.
- Measure tokens per call. Count input tokens (prompt, retrieved documents, conversation history) and output tokens. Output usually costs several times more per token than input, so check both rates on the provider's price page.
- Add the hidden tokens. Reasoning or "thinking" tokens are billed as output even when the user never sees them. Tool results fed back to the model count as input on the next call.
- Count calls per task. An agent that plans, searches, reads and answers might make eight calls, and each call re-sends the growing history. Include retries after errors and re-asks after a bad answer.
- Add the non-token costs. Search or retrieval fees, tool or API fees, and human review time. A reviewer at a loaded cost of 40 dollars an hour who spends two minutes per task adds about 1.33 dollars, often more than all the tokens.
- Divide by successes. Take total cost for a period and divide by tasks that passed your quality bar, not by attempts. If 80 percent succeed, every success carries the cost of the failures too.
Before and after
Weak: "A summary uses 3,000 input tokens and 400 output tokens, so it costs about a cent."
Better: "A summary makes one main call and one check call (two calls, 7,000 tokens in, 900 out), plus 6 percent retries and 1 minute of review on the 15 percent flagged for it. Spend divided by accepted summaries is 4.1 cents."
What goes wrong
- Pricing the happy path. Failures and retries are spend with no output.
- Forgetting history growth. In a long chat or agent loop, call ten re-sends everything from calls one to nine.
- Leaving out people. If review is required, it belongs in the cost, or the feature looks cheaper than it is.
- Averaging across task types. A simple lookup and a long analysis differ by 50 times. Compute each type separately.
Examples
A cost line for one support-ticket reply
| Item | Per ticket |
|---|---|
| Tokens, 3 calls at example rates | 2.8 cents |
| Retrieval query | 0.2 cents |
| Retries (10 percent of tickets) | 0.3 cents |
| Agent review, 45 seconds at 36 dollars an hour | 45 cents |
The tokens are 6 percent of the cost. Cutting prompt length by half saves almost nothing; cutting review time to 20 seconds saves far more. The prices are made up to show the method; use your own.
Success rate changes the answer
Spend is 1,000 dollars for 10,000 attempts. If 9,000 pass, cost per completed task is 11 cents. If only 6,000 pass, it is 17 cents with the same bill. Improving quality is a cost lever, not only a quality one.
Key points
- Cost per completed task is total spend divided by tasks that passed the quality bar, not by attempts.
- Reasoning tokens, retries and re-sent history are billed even though the user never sees them.
- Count calls per task: agents and long chats make many, and each one re-sends the context.
- Human review time and tool or retrieval fees belong in the cost, and are often larger than the token bill.
- Compute each task type separately; one blended average hides the expensive ones.
Common mistakes
- Quoting the list price per million tokens as the cost of the feature.
- Dividing spend by attempts, so failed tasks vanish from the number.
- Ignoring reasoning tokens, which can exceed the visible answer in length.
- Leaving human review out because it sits in a different budget.
Check yourself · 2 of 3
A task makes 4 calls and 1,000 attempts per day cost 50 dollars. 800 attempts pass the quality bar. What is the cost per completed task?
Check yourself · 3 of 3
An agent feature averages 6 model calls per task. Why can its cost per task be much higher than 6 times the cost of the first call?
Practice items, not counted towards your mastery.
Start here
- Claude API pricing (opens in a new tab)DocsFree
Per-token prices for input, output, cached and batch requests, the inputs to every cost-per-task calculation.
- OpenAI API pricing (opens in a new tab)DocsFree
A second provider's price list, to compare model tiers and see how cached input and batch are priced.
- LLM inference prices have fallen rapidly but unequally (Epoch AI) (opens in a new tab)ArticleFree
Measured price declines by capability level, with the spread between tasks that a forecast needs.