Guide · Retries and fallbacks
Retries and fallbacks: counting the real cost of an AI task
Most production AI workloads do not make one call per task. A request times out and is retried, an output fails validation and is asked for again, or a cheaper model gives up and the work falls back to a stronger one. Every one of those attempts can be billed. A price per request describes one attempt; what your team pays for is the finished task.
A retry is a separate request
Count each model call as its own request, including retries, validation re-asks and fallback calls. A task is the unit of work you care about, which may take several requests. If your logs record only the final call, or only successful calls, the cost of the attempts that came before it disappears from your figures.
Where retry and fallback cost hides
- Per-model tables. A routing policy that tries a cheaper model first and falls back to a stronger one splits one task’s cost across two rows. Each model looks reasonable on its own; the cost of the policy appears in neither.
- Success-only logging. Logs that keep only the request that finally worked make every task look like it took one call.
- Failed or timed-out calls. Whether a failed or timed-out call is billed depends on the provider and on how far the call got. Take its cost from your provider’s usage export rather than assuming it was free.
- Re-asks after validation. When an output fails a schema or a check and is requested again, the first output was still generated and usually still billed.
A worked example, on synthetic data
One hundred tasks run through a fallback policy: try model-a1; if it fails, retry once on model-a1; if that fails, make one call to model-b1. All figures are synthetic, the models are fictitious, and the prices are illustrative: $0.004 per call on model-a1 and $0.020 per call on model-b1.
| Step | Calls | Tasks completed | Cost |
|---|---|---|---|
| model-a1, first attempt | 100 | 60 | $0.400 |
| model-a1, retry | 40 | 15 | $0.160 |
| model-b1, fallback | 25 | 22 | $0.500 |
| Whole policy | 165 | 97 of 100 | $1.060 |
The whole policy costs $1.060 ÷ 97 = $0.0109 per completed task, about 2.7 times model-a1’s price per call. Split by model, model-a1 shows $0.560 ÷ 75 = $0.0075 per successful request and model-b1 $0.500 ÷ 22 = $0.0227. Neither row is the cost of the policy, and three tasks were never completed at all.
For comparison, sending every task to model-b1 with one retry (100 + 8 calls, 98 of 100 tasks completed, again synthetic) costs $2.160 ÷ 98 = $0.0220 per completed task. Which policy is better for a real workload depends on its own success rates, prices and how much an uncompleted task matters; the point of the example is that only the per-task figure lets you compare them.
How to log attempts so the cost is countable
- Give every task an identifier and record it on every request the task makes.
- Record the attempt number and whether the call was a retry, a re-ask or a fallback.
- Record the reported cost of every request, failed ones included, and the outcome: success, failure or unknown.
- Record each task’s final outcome once, after its last attempt.
With that, you can produce one row per whole task: the total cost of all its requests and its final outcome. That is the input a cost-per-completed-task comparison needs.
What AIYVO does today, and what is planned
Today, AIYVO is an offline analyzer that reads usage exports you already have, on your machine. It treats a retry as a separate request. When your mapping declares one row per whole task (row_kind: "task"), it reports cost per completed task, counting failures in cost; it does not check that your task rows add up their requests correctly. When rows are requests, it reports cost per successful request and withholds task-level figures, noting that the cost of a completed task can be far higher. It does not call providers and does not verify provider billing. Routing between models and spend governance are planned, not available; the planned-platform simulation shows how they are intended to work, on synthetic data. See also why the cheapest LLM per request can cost more per result.