A plugin to keep track of what AI really costs

Article
Last week I wrote that a subscription to Claude or ChatGPT gives you the wrong picture of what AI costs. You pay a fixed fee, and that fee says nothing about what your usage is worth. Prices will go up, to the point where you have to be careful about what you let AI do and what you don't. So it pays to know what a prompt or a chat session actually costs.
To show where that money goes, I built an interactive model to calculate AI costs. But a model works with example questions, and you look at it once. Awareness needs something you see every day, about your own usage.
So I built a small plugin for Claude Code that keeps track of it while you work: token-cost. It shows what your usage would cost at API prices, live and per period, so the cost stays in view instead of disappearing behind a fixed fee.
How it works
After every turn, the status line shows what the current session would have cost at API prices, next to how much of your five-hour limit you have used. For example:
≈ $3.98 API value · 5h limit 23.5%
Whenever you want the bigger picture, /token-cost adds it all up, across every session on your machine. This is mine, on 18 October 2026:
| Period | Tokens | Responses | API value |
|---|---|---|---|
| Today | 62.7M | 317 | €19.43 |
| Last 7 days | 323.7M | 1,627 | €107.72 |
| This month | 590.3M | 2,992 | €202.94 |
| Total | 813.5M | 3,942 | €266.61 |
It also splits the month per model:
| Model | Tokens | Responses | API value |
|---|---|---|---|
| claude-opus-5-5 | 590.2M | 2,991 | €202.71 |
| claude-sonnet-5 | 68k | 1 | €0.23 |
So €203 in 18 days, on a fixed fee, and all but one response came from Opus, the most expensive model. That is the kind of thing you only notice when you see it. Why output and caching weigh so heavily on a bill like this, I worked out in an infographic on the price per token and the cost per prompt. What a token actually is, I explain in how a language model reads.
To dig deeper:
/token-cost day: the last 14 days with usage/token-cost month: per month/token-cost session: your 15 most recent sessions, with their title and project/token-cost session <id>: one session in detail, per model split into input, output and cache tokens
Options
Language and currency follow your system by default: Dutch and euros on a Dutch locale, English and dollars otherwise. You can change everything with /plugin configure token-cost@token-cost:
| Setting | Default | What it does |
|---|---|---|
language | auto | auto, en or nl |
currency | auto | auto, usd or eur |
eurPerUsd | 0.86 | The exchange rate for euros |
statusLine | on | Show the session's cost in the status line |
Install
In Claude Code, type:
/plugin install token-cost --marketplace martijnwip/token-cost
Answer y to add the marketplace, and it works right away, no restart needed. This one-line install needs Claude Code 2.1.275 or later. On an older version, add the marketplace first and then install the plugin:
/plugin marketplace add martijnwip/token-cost
/plugin install token-cost@token-cost
I've submitted token-cost to the Claude plugin marketplace. Until it's listed there, install it straight from GitHub as above.
Privacy by design
I wanted a tool I could install without a second thought, so it runs entirely on your own machine:
- It makes no network connections and stores nothing.
- It reads the transcripts Claude Code already keeps locally, but only the metadata: model, token counts, timestamp and session id, plus each session's title and folder name. Never the content of your conversations.
- The only program it runs is
grep, to filter very large transcripts down to the lines with token usage.
Every detail is in the privacy policy.
How it calculates
- It uses Anthropic's first-party API rates (October 2026), including cache writes and fast mode.
- Responses that appear twice in the logs count once.
- It is an estimate of the API value. On a subscription you still simply pay your fixed fee.
- Only Claude Code usage on this machine counts, not chats on claude.ai.
The code is open source (MIT) on GitHub. Found a bug or missing something? Open an issue.
More articles
- Showcase: a website for Devil's Island, my neighbourhood
- Prompt engineering
- Paper trail your AI profile
- What I Needed to Move Forward as a Software Developer in the Age of AI
- The AI Footprintmeter
- From Code to Customer Value: My CSPO Journey
- Debugging My Palate: Getting WSET Level 2 Certified
- Elevating Euphoria Academy: A New Premium Look for a Premier Salsa School
- From Idea to Estimate: Navigating the Complexity of Project Quotes using ChatGPT
- Unleashing Next.js, Suspense, and Supabase