GuidesUpdated

Measure AI coding cost per accepted change

Use a repeatable worksheet to compare model choices by accepted work, review time, retries, token categories and provider charges.

On this page

Token totals show what a session consumed, not whether its code was accepted, how much review it needed or what you were charged. Measure cost per accepted change instead.

Illustrative Canopy statistics view with usage grouped by model and CLI
Illustrative Canopy statistics view with usage grouped by model and CLI · Illustrative data; displayed costs are estimates, not provider bills.

Define accepted before you start

Write two or three checks: a behavior, an automated check and a review condition. For a settings form: the name survives refresh, an empty name is rejected, and no high-severity PR findings remain. If one run passes and another doesn't, comparing token spend alone misleads you.

Count the whole attempt, including failures

Log implementation, review, retries and human review time under one task ID, with CLI, model, branch, starting commit, result and commands. When one model fails and a stronger one finishes, count both. Dropping failed attempts makes a routing strategy look cheaper than it was.

Keep token categories separate

Where the CLI reports them, record uncached input, cached input, cache writes and output per model. Providers price these differently, and prices change. Our session-cost calculator turns current rates into an API-equivalent estimate. A plan quota is a different signal; subscriptions, included usage and discounts make what you pay differ.

Compare outcomes on similar tasks

For each strategy, calculate accepted changes per attempt, estimated spend per accepted change and human minutes per accepted change. Compare several similar-scope tasks before ranking small-first against premium-first; different repositories and bars break the comparison.

Use the result to change one decision

Find the expensive boundary: broad prompts, repeated discovery, context resets, review failures or needless premium turns. Change one thing and measure again. Track later rework too; a fast merge that needs fixing next week wasn't cheap.

Want to check the arithmetic? Enter your own token counts and rates in the session cost calculator →

Copyable resources

Copyable accepted-change worksheet

One row per session, then total all sessions for the task.

Task ID and repository: [ ]
Starting commit and branch: [ ]
Acceptance checks: [ ]
Session 1: CLI/model [ ]; role [implement/review/fix]; outcome [ ]; tokens by category [ ]; estimated cost [ ]
Session 2 or retry: [same fields]
Human review minutes: [ ]
Provider charge for this task, if knowable: [unknown, or amount and method]
Final state: [accepted / incomplete / reverted]
Later rework: [none / issue and time]
Compare only with similar-scope tasks and the same acceptance bar.

Frequently asked questions

Can I divide my subscription fee by the number of PRs?

As a rough monthly allocation, if you label the method. It isn't the provider's per-PR charge. Keep subscription payments separate from API-equivalent token estimates.

What if a CLI does not report cache tokens?

Mark the category unknown, not zero. The estimate may be incomplete.

More questions and answers →

Sources and further reading