FinOps for AI: Track What Your Code Costs per Commit

theanonymousone1 pts0 comments

FinOps for AI: Same Game, Higher Stakes | Mooracle<br>Skip to main content

← Back to blog Updated May 24, 2026.

Your team ships a feature. Copilot burns tokens across dozens of completions. Claude runs an agentic session or three. The monthly bill arrives as a lump sum. Which feature cost what? Nobody knows.

Think of it like planning poker with blank cards. Everyone holds up a number, nobody checks after the game. Except the stakes are much higher now — and the whales at this table can always fold and walk away from Copilot.

Contents<br>This is the FinOps gap for AI-assisted development: work is metered at the API level, invisible at the feature level. Cloud FinOps solved the same problem for infrastructure years ago — attribute cost to whatever consumed it. AI coding needs the same treatment.

The practice this article argues for: measure AI cost per work item, feature, or PR. The data is already there — token counts on every API response, rates on every model. The gap is just between the API and git log. Closing it is a tooling problem with several reasonable answers. I’ll suggest one I built; the practice is the point.

Pick whichever unit lets your team compare tasks apples-to-apples — USD, AIC (GitHub’s AI Credits, 1 AIC = $0.01), or raw tokens — and stay consistent. From here on I’ll use “AI cost” generically; switch units in your head as needed.

Why It’s a Real Number Now

On June 1, 2026, GitHub Copilot moves to usage-based billing in AI Credits (AIC). Every plan ships with a monthly AIC allowance, and consumption is metered per token against a published per-model rate card. A single agentic session can burn 600 AIC ($6) or more. The sticker price is the allowance; the question is whether your team’s actual consumption fits inside it.

Until now, “how much will this feature cost in AI?” was a curiosity. After June 1, it’s a planning input — a finite, hard-cap budget like any cloud quota.

Until recently, looking serious about AI meant spending more on it — big tech ran internal leaderboards ranking engineers by tokens consumed. That’s changing fast. Gergely Orosz named the pattern “tokenmaxxing” — whatever gets measured gets gamed, and tokens consumed is the easiest metric to game. Meta shut down its internal usage leaderboard in April (60 trillion tokens in 30 days, ~$900M at API list); Amazon engineers got caught running bot loops to hit a weekly AI-usage mandate.

Token count was the wrong metric. Cost per shipped work item is the next one.

The good news: unlike human effort, AI work comes with a receipt. Every AI call has a token count. Every token has a published rate. When Claude Sonnet generates an auth module, the cost isn’t “about three days of senior engineer time” — it’s 47,000 input tokens and 12,000 output at $3/$15 per million: 32 AIC ($0.32). The data exists at the API level. It just doesn’t reach the commit.

The Commit Receipt

The cleanest place to attribute AI cost is the commit itself. Capture per-request token counts from your assistant, compute cost against the published rate card, and append the total as a git trailer on the commit it belongs to. Then git log is the cost ledger.

A commit with trailers attached looks like this:

alex@mac — web-app — zsh — 110×30

➜ web-app git:(main) ✗

➜ web-app git:(main) ✗ git commit -m "feat: implement OAuth2 login"

1 file changed, 47 insertions(+)

➜ web-app git:(main) ✗

➜ web-app git:(main) ✗ git commit -m "chore: rename Logger class to AppLogger"

8 files changed, 124 insertions(+), 87 deletions(-)

➜ web-app git:(main)

➜ web-app git:(main) git log --format='%h %s %(trailers:key=Copilot-AI-Credits,valueonly)'

71616af chore: rename Logger class to AppLogger 287.40

3499911 feat: implement OAuth2 login with Google + GitHub 47.20

7a127c0 feat: add "Remember me" checkbox to login form 184.50

6eb8f5c fix: typo in submit button label 138.40

418118a feat: add dark mode toggle 31.50

➜ web-app git:(main)

➜ web-app git:(main) git log --pretty='%(trailers:key=Copilot-AI-Credits,valueonly)' \

> | awk '{sum+=$1} END {printf "%.2f\n", sum}'

➜ web-app git:(main) 689.00

(Copilot-AI-Credits is the default trailer; the per-model breakdown and USD-equivalent are opt-in via settings.)

Cost is denominated in AI Credits (1 AIC = $0.01) — the same unit GitHub bills in starting June 1, plan-invariant across Pro, Business, and Enterprise. Copilot Budget reads raw token counts (input, output, cache reads, cache creation) per request and maps them to AIC against the published per-model rate card. The math doesn’t change on June 1, so trailers written today match what GitHub will start billing — no migration step.

Whatever produces the trailers, the trailers are the artifact. Git extracts them by name via the %(trailers:key=...) format placeholder — cost for the current branch is a one-liner:

git log origin/main..HEAD \<br>--pretty='%(trailers:key=Copilot-AI-Credits,valueonly)' \<br>| awk '{sum+=$1} END {printf "%.2f AIC\n", sum}'<br>Drop it into PR CI for...

cost main commit copilot trailers token

Related Articles