AI Spend Ledger: Track AI and LLM Costs With Claude Skills
The AI Spend Ledger is a free, open-source set of twelve Claude skills and six short lessons. It shows what AI costs your company per customer, feature and model, explains why the bill moved, and ranks what to change first, with every figure computed by a script on your own files.
Runs in claude.ai, the Claude desktop app and Claude Code · Version 1.0.0
Claudeboard-ai-spend-brief
Write the October AI spend brief for the board.
AI spend brief: October 2026
$115,021
AI spend, up $37,391 on September
AugSepOct
AI usage cost as a share of revenue
13.0%
Provider invoices the ledger explains
94.9%
Customers above 20% of revenue
1
Sample output for Northpeak, the pack's fictional sample company
What Is the AI Spend Ledger?
The AI Spend Ledger is an open-source toolkit for AI cost management, built as Claude skills. Give Claude your AP or card export, your Anthropic or OpenAI usage export and your invoices, and it builds one usage ledger, prices it at your contract rates, checks it against the bill and explains the result. Python scripts do the arithmetic, so every number in a report traces back to a file.
What it is
Twelve Claude skills, six short lessons, three months of sample data and a worked report for every skill
Who it is for
CFOs and finance teams, CTOs and engineering managers, COOs and product leads
Runs in
claude.ai and the Claude desktop app on Pro, Max, Team or Enterprise plans with code execution on, and Claude Code
Works from
AP, card or expense exports; Anthropic and OpenAI usage and cost exports; your app's usage log; provider invoices; customer MRR
Produces
Markdown reports and CSV files, from the AI spend inventory to a one-page board brief
Your data
The scripts read and write local files. One optional script downloads your own usage from Anthropic or OpenAI
License
MIT. Version 1.0.0, released November 2026
Twelve Skills, One Ledger
Each skill answers one question a finance or engineering lead asks about AI spend. They all read the same usage ledger, so their answers agree, and they follow the order we work in: measure, route, trim, own, then report.
Step
Skill
Answers
Measure
ai-spend-inventory
What do we pay for that is AI, and who owns it?
cost-attribution-ledger
Which customers, features and models drive the bill?
invoice-reconciliation
Does our tracking match the invoice?
spend-change-diagnosis
Why did the bill move this month?
ai-unit-economics
What does AI cost per customer and plan, against revenue?
Route
eval-gate
Is the cheaper model good enough for this task?
model-routing-review
Which features could run on a smaller model, and for how much less?
Trim
token-waste-audit
Where do retries, failures, long prompts and missed caching cost the most?
Own
self-hosting-break-even
At what volume do our own GPUs beat the API?
Report
spend-forecast
What will AI cost over the next six months?
spend-guardrails
Which alerts and limits catch a surprise bill early?
board-ai-spend-brief
What goes on the one page for the board?
Finance teams usually start with the inventory, reconciliation, unit economics, forecast and board brief. CTOs and engineering managers start with attribution, evals, routing, the token audit and self-hosting. Operations and product leads get the most from change diagnosis, per-customer cost and guardrails.
How to Track AI Spend per Customer, Feature and Model
Track AI spend with a usage ledger: one record per model call, or per day, holding the customer, the feature, the model and the token counts the provider returned. Price it at your contract rates and check the total against each provider invoice. An invoice on its own gives the total; the ledger shows where it came from.
Start from what finance already has
Begin with finance's data rather than engineering's. An AP, corporate card or expense export lists every AI vendor the company pays, including the ones engineering never sees, such as shadow AI: assistant subscriptions on expense reports, meeting-note tools a sales team signed up for, and GPU time in a cloud account. ai-spend-inventory sorts each line into a category, names its owner or flags that none exists, and finds overlapping tools, such as two coding assistants with a few seats each. AI features bundled into existing SaaS are listed at full price and kept out of the AI total, because only part of that price is AI.
Build a ledger from provider exports, with no code changes
Anthropic and OpenAI both record usage and cost per API key, workspace or project. fetch_usage.py downloads those exports with an admin key, and the provider exports guide shows how to get one. cost-attribution-ledger imports them, asks you to name each key, and writes a price sheet for your contract rates. With one API key per feature, and one per large customer, that already gives cost by feature and model, the month-over-month bridge, caching gaps, reconciliation against the bill and a forecast.
Log usage in your app for cost per customer
Provider exports carry no customer IDs and often no retry or failure counts. For those, a thin wrapper around the provider SDK logs one row per call. The event schema has the full field list and a Python wrapper; these fields do most of the work:
Field
Why it matters
customer_id
Cost per customer. Log the account, not the end user
feature
Cost per feature. One stable name per product surface
run_id, attempt
Groups the calls of one task, so retries per run are visible
provider, model
Pricing, and the routing review
input_tokens, output_tokens
Cost, taken from the provider's usage block, never a local tokenizer estimate
cache_read_tokens, cache_write_tokens
Cached input is priced differently, so each is stored and priced once
status, run_completed
Failed work, and cost per completed task
environment
Keeps staging and eval traffic out of customer cost
The unit that matters is cost per completed task, including the retries and failed attempts it took to get there. A cheaper call that fails a third of the time can cost more per finished task than an expensive one that works first time.
Reconcile the ledger with the invoice
A ledger counts only what the app logged. The difference from the invoice is untracked usage: staging and CI keys, evaluation runs, notebooks and background jobs that skip the wrapper. invoice-reconciliation measures that gap per provider and month against a target, 5% by default, and lists the likely causes, starting with API keys used outside the app. Support plans, credits and taxes stay out of the usage gap. A ledger above the invoice usually means double-counted retries or a price table above the contract rate.
Why Did Our AI Bill Go Up?
AI usage is metered per token, so the bill is a product of three factors rather than a count of seats:
spend ≈ effective price per token × tokens per task × number of tasks
Each factor moves for its own reasons, and different people control them. Price per token moves when someone changes the model a feature calls, when prompt caching starts or stops working, or when a provider changes rates. Tokens per task moves when a prompt grows, and it can double after a release that looked small. Number of tasks moves with customers and usage, which is the part that should grow. So the bill can rise 40% in a month with no new contract, and the invoice shows the total but not which factor moved.
spend-change-diagnosis splits a month-over-month change into new customers, more use by existing customers, retries, tokens per attempt, price and model mix, and usage the app did not log. The effects add up exactly to the change. It also flags a 31-day month against a 30-day one, and asks what shipped between the two periods, because a release date that lines up with a jump in tokens per attempt is the usual cause. In the pack's sample company, Northpeak, usage spend rose 41.4% in a month, from $68,660 in September to $97,091 in October:
Monthly usage spendGrowthEngineering work
What drove Northpeak's usage spend from September to October 2026
Driver
Effect
Share
September 2026 usage spend
$68,660
New customers (C023, C024)
+$10,523
37.0%
More use by existing customers
+$4,137
14.6%
Longer prompts per attempt, mostly chat assistant
+$7,406
26.0%
More retries per run, chat assistant
+$1,780
6.3%
Usage the app did not log
+$4,586
16.1%
October 2026 usage spend
$97,091
Growth accounts for about half. The rest is longer prompts, retries and tracking, and all three are engineering work. Northpeak is fictional; the same analysis runs on your own exports.
How to Reduce LLM Costs: Measure, Route, Trim, Own
Once spend is measured, three levers lower it, and the order matters. Routing without evals is a guess. Trimming without evals breaks answers quietly. Self-hosting before routing compares your GPUs with a bill that was already too high. Each step has a five-minute lesson in the repository.
Route: the least expensive model that passes its eval
Many tasks, such as tagging, short summaries and extraction, pass just as well on a model that costs a fifth as much or less. Model routing runs each feature on the least expensive model that passes that feature's evaluation. Build the eval from 100 to 300 real production inputs, including the hard and odd ones, and grade each output pass or fail. eval-gate judges each model on its pass rate and the 95% lower bound of that rate, so a 97% pass rate on 200 cases reads as provisional against a 95% bar, and one critical failure, such as a wrong amount or an invented fact, disqualifies a model whatever its pass rate. model-routing-review then prices the month's real tokens on each cheaper model, including the cost of falling back when it fails.
In one recent engagement, Opus fell from 80.6% to 29.1% of Anthropic spend while Sonnet and Haiku together rose from 19.4% to 68.3%. Spend on the smaller models went up, and the total went down. Other changes shipped in the same period, so routing alone does not account for the whole drop.
Trim: fewer tokens per task
Most token waste hides in four places. Retries resend the full prompt, so give each run a retry budget, two is a common start, and log why each retry happened. Failed runs spend tokens and deliver nothing, so count cost per completed run. Context grows by accretion: full conversation history, extra retrieved documents, tool results pasted whole. And prompt caching misses when something that changes, such as a timestamp or a user name, sits near the top of the prompt; put the stable parts first. token-waste-audit checks every feature for all four and ranks the findings in dollars. The findings overlap, so fix the largest one and re-run the audit.
Own: self-hosting break-even
Owned GPUs turn a per-token bill into a mostly fixed monthly cost, so utilization decides whether they cost less. self-hosting-break-even builds the full monthly cost from your quotes and measured throughput: amortized hardware, power with data-center overhead, rack space, operations time, setup and spare capacity. It compares that with the cheapest API option that passes your evals, after routing and trimming. In the Northpeak sample, one owned server looks 68% cheaper than the current API bill for two features. Against the same features routed to a mid-size API model, the API is about $1,600 a month cheaper, and owning breaks even at roughly 1.2 times today's volume.
API, current modelsAPI, routed to a mid-size modelSelf-hosted, one server
$40k$30k$20k$10k$0k
Today, 3.26B tokensBreak-even, about 1.2× todayAPI, current modelsAPI, routedSelf-hosted, one server
0B1B2B3B4B5B6B
Monthly cost against tokens a month, for Northpeak's ticket summaries and tagging. The self-hosted line is one server's full monthly cost: hardware, power, hosting, operations and setup. In the sample, the open-weight model has not passed its eval yet.
At today's volume
Monthly cost
API, current models
$32,780
Self-hosted, one server
$10,435
API, routed to a mid-size model
$8,819
AI Cost per Customer, Forecasts and the Board Page
AI unit economics
ai-unit-economics sets each customer's AI cost against its monthly recurring revenue, overall and by plan, and flags customers above a threshold, 20% of revenue by default. In the sample, AI usage costs 13.0% of Northpeak's revenue, but one Starter customer paying $7,500 a month runs at 39.3%, most of it from the chat assistant. Each flagged customer comes with three options: price it, cap it, or make the feature cheaper. The report calls this AI cost, not gross margin, unless you supply the other costs to serve.
40%30%20%10%0%
Flag at 20% of revenue
Quarry Manufacturing, Starter: 39.3%
AI cost as a share of monthly recurring revenue, one column per Northpeak customer, October 2026. Cost includes each customer's share of untracked usage.
Plan
Customers
MRR
AI cost
AI cost / MRR
Enterprise
12
$557,000
$67,467
12.1%
Growth
8
$160,000
$22,954
14.3%
Starter
4
$29,500
$6,671
22.6%
Forecast and guardrails
spend-forecast projects six months per feature from runs per day, growth from existing customers, new customers per month and cost per run, with low, base and high cases, and adds planned changes from the month they ship. Monthly invoices arrive too late to catch a looping agent, so spend-guardrails suggests starting values for limits that fire within a day:
Limit
Starting value
Daily cost alert per feature
Weekday average plus three standard deviations
Token ceiling per run
About twice the average run; truncate or stop above it
Retry budget per run
Two retries, then fail cleanly and log why
Monthly AI budget per customer
A share of that customer's revenue, 20% by default
Provider-side limit per API key
Above the forecast high case, with separate keys for production, staging and evals
Watch them for two weeks, then tighten the ones that never fire and loosen the ones that fire on normal days. A customer over budget is a commercial decision about pricing, contract terms or a cheaper model, more than an engineering one.
The one-page board brief
board-ai-spend-brief assembles one page from the other reports: spend and trend, what drove the change, AI cost as a share of revenue, tracking accuracy, risks, decisions needed and the forecast. Decisions come first, each with its effect, its evidence and an owner. Every figure comes from a report, and anything missing goes under Data needed. Savings that passed their eval and savings still under test are listed apart and never added together. The finished brief for Northpeak shows the result.
How to Install the AI Spend Ledger
There are two ways to install it. Download the zip if you use Claude on the web or the desktop app. Clone the repository if you use Claude Code, or want only some of the skills.
Download the zip, for claude.ai and the desktop app
ai-spend-ledger-skill.zip holds all twelve skills as one, for a single upload. Skills need a Pro, Max, Team or Enterprise plan with code execution switched on.
To share the skills with your team instead, copy them into .claude/skills/ inside a project repository. To install only some of them, copy just those folders.
Check it on the sample data
The sample-data/ folder in the repository, also in the full ai-spend-ledger.zip, has three months of data for Northpeak. Start a new chat, attach ap-export.csv, and paste:
Use the AI spend ledger on this export. Tell me what we spend on AI, who owns each line, and what needs a decision.
Then attach usage-ledger.csv, model-prices.csv and provider-invoices.csv, and paste:
Explain why AI spend changed from 2026-09 to 2026-10. Include untracked usage from the invoices.
Compare the answers with the reports in examples/. On your own files, column names can differ from the sample; Claude maps them before it runs a script and asks when a mapping is unclear.
How the Numbers Are Made
A spend report is only useful if finance can trace every figure in it. Four rules run through all twelve skills.
Scripts compute, Claude explains
Every figure comes from a Python script that runs on your files. Claude chooses the script, maps your columns and explains the output. When a figure needs data you have not given it, the report lists it under Data needed, and provider-only data shows n/a for the per-customer and retry figures it cannot support.
Your contract rates, never list prices from memory
Prices come from a table you fill with your own contract rates, including cached-token rates. When a ledger is built from provider exports, the skill writes the models it found to a price sheet and asks you to fill it in.
Overlapping savings stay apart
Findings from the token audit overlap, so they are ranked rather than summed. On the board page, savings that passed their eval and savings still under test are listed separately.
Your files stay local
The scripts read and write local files. The one exception is fetch_usage.py, which you run yourself to download your own usage from Anthropic or OpenAI with your admin key, and it contacts only that provider's API.
Where It Comes From
The pack is the method from a few recent AI cost engagements at ProductiveHub, written down so a finance or engineering team can run it on its own data. In one of them, a YC-backed startup took provider spend from about $230,000 to $120,300 a month over five billing cycles with the same four steps, while its client base grew. The case study sets out what was measured and what was not.
We run this method with clients as part of our AI transformation work, alongside the AI Gateway and AI Bridge plumbing that turns a model swap into a configuration change. Re-run the pack monthly, after each provider model release, and after any release that changes a prompt. Notes on what to add or fix go to team@productivehub.com or the issues on GitHub.
Questions People Ask
What is the AI Spend Ledger?
The AI Spend Ledger is a free, MIT-licensed set of twelve Claude skills and six short lessons from ProductiveHub for AI cost management. It builds a usage ledger from your finance and provider exports, prices it at your contract rates, reconciles it with each invoice, and explains what AI costs per customer, feature and model, why the bill moved, and what to change first. Python scripts compute every figure from your own files.
How do I track LLM costs per customer and per feature?
Keep a usage ledger: one record per model call, or a daily rollup, with the customer, the feature, the model and the token counts from the provider's response. Price it at your contract rates and check it against each invoice. The cost-attribution-ledger skill does the pricing and the breakdown by customer, feature and model, and the pack includes the event fields and a Python wrapper to add to your app.
Can I track AI spend without changing our code?
Yes, by feature and model. Download the usage and cost exports from Anthropic or OpenAI with an admin key, and import them into a ledger. With one API key per feature, and one per large customer, that gives cost by feature and model, the month-over-month change, caching gaps, reconciliation against the bill and a forecast. Cost per customer, retries and failed runs need your app to log usage; until it does, the reports mark those figures n/a.
Why did our OpenAI or Anthropic bill go up?
AI spend is roughly the effective price per token, times the tokens per task, times the number of tasks, and each factor moves for its own reasons. The spend-change-diagnosis skill splits a month-over-month change into new customers, more use by existing customers, retries, tokens per attempt, price and model mix, and usage the app did not log. The effects add up exactly to the total change. Growth effects are healthy when revenue grew with them; efficiency effects are engineering work.
How do I reduce LLM API costs while keeping quality?
Work in four steps, in order. Measure what every task costs. Route each feature to the least expensive model that passes an evaluation built from 100 to 300 of your own production inputs. Trim retries, failed runs, context growth and missed prompt caching. Move steady, high-volume work to your own GPUs only once the volume justifies it. Every change goes back through the same evaluation before it counts as a saving.
When is self-hosting an LLM cheaper than using the API?
When utilization is high enough. Count amortized hardware, power with data-center overhead, rack space, operations time, setup and spare capacity, and compare the total with the cheapest API option that passes your evals, after routing and trimming. In the pack's sample company, one owned server looks 68% cheaper than the current API bill, yet the routed API is about $1,600 a month cheaper, and owning breaks even at roughly 1.2 times today's volume.
What should an AI spend report to the board include?
Spend and trend, what drove the change, AI cost as a share of revenue, how much of the provider invoices the usage tracking explains, the risks, the decisions needed with an effect, evidence and owner for each, and a forecast. Savings that passed their evaluation and savings still under test are listed apart and never added together. The board-ai-spend-brief skill assembles that page from the other reports.
How is this different from an LLM observability or AI FinOps tool?
Observability tools and AI gateways sit in the request path and record each call as it happens. The AI Spend Ledger is a method and a set of scripts that runs inside Claude on files you already have: finance exports, provider exports, invoices and usage logs. A log export from an observability tool or gateway can serve as its usage ledger. Guardrails come out as suggested alert values and provider limits to enter in the tools you already run.
Which Claude plan do the skills need, and where does my data go?
Skills in claude.ai and the Claude desktop app need a Pro, Max, Team or Enterprise plan with code execution switched on; they also run in Claude Code. The scripts read and write local files. The one exception is fetch_usage.py, which you run yourself to download your own usage from Anthropic or OpenAI with your admin key, and it contacts only that provider's API.
Is the AI Spend Ledger free, and can I change it?
Yes. It is MIT-licensed: use it, change it and share it, and keep the copyright notice. Version 1.0.0 was released in November 2026. Suggestions for the next version go to team@productivehub.com or to the issues on GitHub.
Want Help With Your Own AI Spend?
We help growing US companies put AI into production and keep it affordable, reliable and governed. If you want help putting this method to work on your own numbers, the first conversation is free.