Example
If the all-strong estimate is $0.42 and tokenpatch execution costs $0.08, the estimated savings ratio is 81%.
Cost calculator
The useful unit is not one API request. For AI coding, the useful unit is an accepted patch. tokenpatch reports executor usage, estimated all-strong baseline, actual executor cost, and savings ratio after each bounded run.
| Metric | Formula | Why it matters |
|---|---|---|
| All-strong baseline | Strong model input/output tokens x strong model price | Approximates what the task would cost if the expensive model did all implementation work. |
| Executor actual | Executor input/output tokens x executor price | Shows the lower-cost implementation spend for the bounded patch. |
| Savings ratio | (baseline - actual) / baseline | Turns token savings into a task-level percentage that is easy to compare across runs. |
| Cost per applied patch | Actual executor cost / accepted patch count | Filters out vanity request metrics and focuses on useful code changes. |
If the all-strong estimate is $0.42 and tokenpatch execution costs $0.08, the estimated savings ratio is 81%.
Track baseline, executor usage, accepted patch status, validation result, and whether the diff stayed inside allowed files.
Do not optimize only for cheapest tokens. A failed patch can cost more than a slightly stronger executor that lands the change.