00 AI usage audit
Free AI usage audit skill for Claude: Find where your tokens go.
Every AI call pays again for everything it carries: the rules, the history, the tools. This free skill reads how your product calls AI, traces each call and writes one short report: every leak, its file and line, the cause and the fix.
One skill · 84 checks · four scripts · free, MIT License
it reads your code. it never runs it.
Receipt · One long chat 4 Nov 2026
Claude Code 2.1.311 · Sonnet 5.5 · medium
Eight short commit messages
- Sent after Ticket 1 127,659 tokens
- Sent after Ticket 2 170,375 tokens
- Sent after Ticket 3 196,401 tokens
- Sent after Ticket 4 217,036 tokens
- Sent after Ticket 5 235,977 tokens
- Sent after Ticket 9 305,264 tokens
- Sent after Ticket 11 372,796 tokens
- Sent after Ticket 13 444,726 tokens
- Messages
- 8
- Typed
- 129 characters
- Paid
- 2,070,234 tokens
Every call sent the whole chat again
all that was typed.
01 The pile
Every new prompt pays for everything above it.
AI models keep nothing between calls. So every call sends the whole conversation again: the rules, the files, every earlier answer. That is why AI gets so expensive the longer you use it.
The pile · one page a turn Sketch, not data
- Pages sent
- 1
- Pages written
- 1
- Sent for each page written
- 1
1 page sent to write 1. Nothing is paid twice yet.
- Pages sent
- 15
- Pages written
- 5
- Sent for each page written
- 3
15 pages sent to write 5. The first page went out 5 times.
- Pages sent
- 55
- Pages written
- 10
- Sent for each page written
- 5.5
55 pages sent to write 10. The first page went out 10 times.
- Pages sent
- 210
- Pages written
- 20
- Sent for each page written
- 10.5
210 pages sent to write 20. The first page went out 20 times.
- Pages sent
- 820
- Pages written
- 40
- Sent for each page written
- 20.5
820 pages sent to write 40. The first page went out 40 times.
“a 10-turn session sends the first page 10 times” From the skill’s severity guide
A sketch: every turn adds one page and nothing is trimmed. Real calls also carry the system prompt, the tool list and files. Caching makes old pages cheaper. They still count as tokens.
This sheet needs a newer browser to change. It shows 10 turns.
“Two tokens do not cost the same.”
From video 03. My second build used about 6 times fewer tokens than the long chat. Its bill was 9% lower.
What I measured
Receipt · Calls nobody typedReceipt · Nobody typed 4 Nov 2026
4.4M of 18M tokens
In one long Claude Code chat, 4.4 million tokens went to calls nobody typed. It sent prompt suggestions and session recaps on its own.
Source My own test, video 03: the long chat’s session filesReceipt · Skills on every callReceipt · Skills 5 Nov 2026
Up to 83 skills
In my first build, up to 83 skills were listed on every call. The build never used them: about 1.5 million tokens.
Source My own test, video 03: build 1’s session filesyou’re paying for it
in every single prompt.
Receipt · Price by kind Checked 17 Nov 2026
1 · 20 · 40 · 100
A cache read, input, a one-hour cache write and output, as ratios at Sonnet 5.5 list prices. What the model writes costs 100 times what it reads from the cache.
Source Anthropic, Claude Platform Docs, Pricing platform.claude.com (opens in a new tab)02 The trace
The leak is rarely in the call itself.
It sits in the chain around it: what triggers the call, what gets stuffed into it, what happens to the answer. So the skill finds every AI call in your code and follows each one end to end.
import OpenAI from 'openai';
import { retrieve } from '@/lib/retrieve';
import { RULES } from '@/lib/prompts/support-agent';
const client = new OpenAI();
export async function POST(req: Request) {
const { message, customer } = await req.json();
const chunks = await retrieve(message, { k: 25 });
const system = [
`Today is ${new Date().toISOString()}. Customer: ${customer.name}.`,
RULES,
...chunks.map((c) => c.text),
].join('\n\n');
const res = await client.chat.completions.create({
model: 'gpt-4.1',
n: 3,
messages: [
{ role: 'system', content: system },
{ role: 'user', content: message },
],
});
return Response.json({ reply: res.choices[0].message.content });
} Notes
- Issue 1, line 9: 25 articles. every message.
- Issue 2, line 11: the time goes first. no two prompts match.
- Issue 3, line 18: three replies. line 24 shows one.
- Issue 3: src/app/api/chat/route.ts:16 asks for more than one output per call (n or candidate count): check how many are used.
- Issue 2: src/app/api/chat/route.ts:11 puts the current date or time into text sent to the model: if that text sits before static content (or inside a cached block), it changes every request and defeats caching.
This is a map, not a verdict. Open every location and read the surrounding code before you conclude anything.
Issue 1: It never flagged line 9. The skill found that one by reading what goes into the prompt, piece by piece.
Seven questions for every call
-
Trigger What causes this call? A user message, a keystroke, a page load, a cron job.
-
Frequency How often does that trigger fire? A call inside a loop runs once per item.
-
Input What goes into the prompt, piece by piece, and about how many tokens is each?
-
Settings Which model, output cap, reasoning effort, caching and service tier?
-
Output What happens to the answer? How much of it is actually used?
-
Failure handling What do retries, fallbacks and parse-failure loops run again?
-
Repeats Is the same input sent more than once per user action?
From the skill’s discovery guide
What it checks for
84 checks, in four catalogs.
-
checks-calls-and-models.md
Calls and models: 23 checks
When and how often the model is called, model choice, output and reasoning settings, spend visibility.
- CAL-07 Work nobody waits for runs synchronously at full price instead of a batch API
- CAL-06 Retry loops re-run the whole call: on parse failures, refusals, truncation or 400s, with no cap or backoff
- CAL-16 Output is longer than the product uses: no length or verbosity setting, explanations or reasoning written into an answer that is thrown away
-
checks-context.md
Context: 21 checks
What goes into each call: prompt caching, prompt size, history, retrieval, tools and agent loops, images.
- CTX-A01 Changing text sits ahead of the stable part of the prompt, so the prefix cache never hits
- CTX-C01 The whole history is re-sent every turn with no trimming, compaction, context editing or memory
- CTX-E01 Every tool and MCP definition is sent on every request, though each turn uses a few
-
checks-prompts.md
Prompts: 28 checks
Prompting quality, and the reliability and security problems that come from how prompts and outputs are handled.
- PRM-A01 The prompt never says what to return: format, length, audience, final-answer shape
- PRM-B01 Scaffolding written for an older model is still in the prompt
- PRM-F01 Output is trusted once it parses: values, refusals, truncation and enum casing go unchecked
-
checks-dev-setup.md
Dev setup: 12 checks
The AI instruction files and MCP configs your team’s coding agents load. Only when the repo has them.
- DEV-01 Always-loaded instruction files exceed the tool’s size guidance or hold material most sessions never use
- DEV-06 MCP servers and tool definitions load up front, including servers nobody uses
- DEV-11 Agent sessions run long across unrelated tasks, keep verbose output in context, or break the cache
Three of each, with their numbers. The zip has all 84.
Before anything becomes a finding
“A scanner hit or a catalog match is a lead. A finding is a claim you can defend.”
So it opens the code again, looks for whatever already handles the problem, and sizes it. Then a second pass has one job: prove the finding wrong. What survives partly is downgraded. What doesn’t is cut.
Looks like waste. Usually isn’t.
- Not a finding:
a high output cap (a cap, not a charge) - Not a finding:
a large model behind an eval-backed router - Not a finding:
caching a gateway already does - Not a finding:
a documented deliberate trade-off
cut. all four.
03 The report
One finding is one problem with its cause and its fix.
The top is for a founder: a verdict and the one thing to fix first. The findings are for a developer, or their AI coding tool: the file and line, the cause, the fix and how to confirm it worked.
What every report holds
- The verdict Two sentences, and the one thing to fix first.
- What holds up The parts done right, so nobody breaks them while fixing the rest.
- Fix order One table to schedule the work.
- Findings Impact, where, issue, cause and fix. The serious ones say how to confirm it.
- Worth testing Ideas that are not proven problems, kept apart from the findings.
- How it was done What was read, what was assumed, what was not checked.
- A fix prompt To paste into your AI coding tool, one finding at a time.
Severity follows real impact
- Critical
- 25% or more of AI spend, or waste that grows without limit
- High
- 10% to 25% of spend, or a core feature regularly worse
- Medium
- 3% to 10%, or a secondary feature
- Low
- Under 3%, or hygiene
Its last line says which skill made it. A short note about a 20-minute call shows only when it found a Critical or High issue. It’s your report: delete either.
good work gets credit.
nothing is invented.
04 Get the skill
Want to know where yours go?
One skill, nine guides and four scripts, in one zip. Open your project and ask where it wastes tokens. It reads the code, never runs it, and writes one report. Read every file before you run it. I would.
- ai-usage-audit-skill.zip
- inspected-by-m-ai-usage-audit/
- LICENSE : MIT, word for word
- README.md : how to install and use it
- SKILL.md : the method and the workflow
- references/ : 9 guides
- discovery.md : finding and tracing every call
- checks-calls-and-models.md : 23 checks
- checks-context.md : 21 checks
- checks-prompts.md : 28 checks
- checks-dev-setup.md : 12 checks
- vendor-facts.md : dated prices and limits
- severity.md : how a leak is sized
- report-spec.md : what the report holds
- brand-and-help.md : what it says about me
- assets/
- brand.json : the credit line, the note
- scripts/ : Python 3
- scan_ai_usage.py : maps every AI call
- estimate.py : token and cost arithmetic
- render_report.py : writes the report
- check_report.py : checks the report
- Works in
- Claude Code, or the Claude app with code execution on. With web search on, it checks prices on the vendor’s own page.
- Needs
- Your code, or at least the prompts and call settings. Python 3 for the four scripts.
- Never
- Runs your code: no installs, no builds, no AI calls, no requests to a live app.
- Yours to
- Copy, change and share, under the MIT License.
Check your inbox.
My email didn’t go out.
- Sent to
- the address you entered
- Skill
- AI usage audit
One more thing
Want the newsletter to fit what you read? Say yes and I’ll email you a link. Open it and confirm, and a cookie in that browser lets the site keep a list of the pages you read here, with dates, next to your email, for 13 months. I use the list only to choose what I send you, and I share it with no one. Switch it off any time.
Free to copy, change and share, under the MIT License. It comes with no warranty: read a skill before you run it.
How I use your emailBox not ticked? You get the skill and nothing else, and your address is deleted after 30 days.
05 Work with me
Your AI bill is in order. Are its answers?
If your product has paying customers and you want AI added to it, or the AI in it fixed, me and my team build it. Week one is a working prototype on a sample of your data, for $7,000. You try it, then you decide on the build.
Not ready? Watch the videos on YouTubeNot ready? Watch on YouTube (opens in a new tab)- The build
- from $45,000
- Monthly
- from $4,500 a month
I read every request myself.
Free, 20 minutes. For software companies with paying customers.