How it works
Spend is the money for the attempts you include, priced from the pricing page for input, output, and cached input where it was reported. Finished tasks are attempts that met the pass rule. Divide spend by that count. A failed attempt still cost money, so its spend stays in the numerator and it adds nothing to the denominator. Cost per request divides the same spend by every attempt, and it looks kinder when many attempts fail. Use cost per task when the question is what a completed piece of work cost. Keep the price source beside the figure, because a price change moves it without any change in tokens or success.
A bookkeeper codes supplier invoices: nominal, tax code, and supplier. Six are attempted. Four meet the pass rule. Two stop after a tool error and still consumed model calls. Spend is the price of all six. Cost per task divides that spend by four. Cost per request divides it by six and understates a coded invoice. Dropping the failures from the spend pretends they were free.
A worked example
Six invoices, four of them coded
Pass rule: nominal, tax code, and supplier are filled and match the invoice.
Morning: 6 attempts. 4 finished. 2 stopped after a tool error, and each of those still made a model call.
Spend, pricing page applied to the reported tokens: GBP 3.00 across all 6. The 2 stopped attempts are GBP 0.80 of that.
Cost per task = 3.00 / 4 = GBP 0.75.
Cost per request = 3.00 / 6 = GBP 0.50.
The 0.50 figure uses the request as the unit, so failures make the work look cheaper. The 0.75 figure is what a finished coding cost, because the failed runs were paid for. Dropping the 0.80 from the spend would hide the errors instead of pricing them.
Illustrative example, not a production trace and not a measured result.
What goes wrong
- Spend is divided by requests. The two tool errors make cost per request fall, and a worse morning looks like a cheaper agent than the coded work was.
- Failed runs are removed from the spend. The errors vanish from the cost as well as from the success count, so the waste is not visible on the books.
- A list price is used after the contract price changed. Token counts are right, the money is wrong, and the invoice does not match the dashboard at all.
How to measure it
Pick the task and the pass rule first. Sum the spend for every attempt at that task in the period, including failures and retries you have agreed to include. Divide by the number of attempts that met the rule. Show cost per request beside it if you need both.
When the ratio moves, split the change into price, tokens per attempt, and the finished share. A price change, a longer prompt, and a lower success rate can all raise cost per task, and they ask for different fixes.
Further reading
How Abracadabra helps
Divide spend by finished invoices, and leave the failed runs in the spend. A cheap request that did not code the invoice is not a cheap task. The finished count is the outcome on the conversation.
A trace says the run finished. Abracadabra says whether the person got the job they came to do, and keeps that outcome on the conversation. It complements tracing and OpenTelemetry. It does not ingest spans or replace a trace tool.
Request access to read this on your own agent.