AI Usage
Windows 10 1809+ / 11, x64 WinUI 3 · .NET 10 Local only MIT

Claude Code and Codex usage,
counted on your own PC.

Both coding agents write every turn to transcript files on disk, with the tokens it used. AI Usage is a native Windows app that reads those files and shows tokens, estimated cost and approximate runtime, overall, per project and per day. It makes no network calls, runs no server and needs no account: every number is recomputed from disk on each refresh.

Claude Code%USERPROFILE%\.claude\projects\
Total estimated spend

Tokens priced at Anthropic's per-token API rates, from a built-in rate card you can override.

Codex%USERPROFILE%\.codex\sessions\
API-equivalent spend

What these tokens would cost through the OpenAI API. Codex is often used on a flat ChatGPT plan, so this is not necessarily what you paid.

Each agent has its own accent and its own headline. The two figures mean different things, so the app never adds them together.

How it works

Both transcript formats are undocumented and change between versions, and each one hides a few traps that would quietly skew the totals. A bad line is skipped with a warning; the parse keeps going.

Claude Code one JSONL file per session
  1. Find every fileSubagent transcripts are nested inside their session's folder. They are real, separately billed usage, so the search recurses.
  2. Count each message onceAbout half the lines repeat a message: streaming partials, and resumed sessions that copy the old conversation into a new file. Messages are de-duplicated across all files by message id and request id, oldest file first, so a replay is credited to the original.
  3. Recover the real output countEarly partials log a placeholder of 1 to 4 output tokens; the largest value per message is the true one.
  4. Price cache writes by lifetime5-minute and 1-hour cache writes cost different amounts and are priced apart.
  5. Name the projectFrom the working directory that re-encodes to the folder's own name, not the first one in the file, which may be a replayed path from another project.
Codex one rollout per thread, by date
  1. Turn running totals into turnsUsage is logged as a cumulative total and readings repeat, so each turn is the change in the total. A total that goes backwards is a new baseline, never negative usage.
  2. Separate cached inputLogged input already includes cached tokens; Input shows only the uncached remainder.
  3. Keep reasoning inside outputReasoning tokens are part of output, so they are shown but never added a second time.
  4. Count auto-review threadsReview threads live in their own files and are real spend, shown as their own model.
  5. Follow the model and folder as stateA usage reading names neither; they come from the most recent turn context, so every reading is attributed on its own.
  6. Bill long prompts at OpenAI's higher tierA request whose prompt is over 272K tokens costs 2x input and 1.5x output on the models that have the tier, checked request by request.
A daily archive per agent Both agents delete old transcripts. Each day's numbers are kept, so a deleted file never shrinks a total.
The app A WinUI 3 window with the Overview, Projects, project and history pages, plus a tray icon with today's spend.

Every chart, live

Drawn here from a fixed random seed, so every number is invented. In the app they are hand-drawn on XAML shapes, without a chart library.

Everything it does

Reading it

  • A sidebar picks the agent; the top bar picks Overview or Projects, refreshes (or F5), and opens Settings. It shows when the data was last read and how long that took.
  • A project page is the overview at project scope, in the same order, followed by its own day-by-model table.
  • Expand on any heat map opens the full history, for the agent or for one project.
  • Info tips explain how each figure is measured. Every number and label can be selected and copied.
  • Chart tooltips name every band, so colour is never the only way to read a chart.
  • The sidebar collapses to icons, and remembers.

Projects

  • Rename… changes the label only; nothing on disk is renamed.
  • Merge into… counts one project as part of another, such as a folder that moved. No total changes, and older archived days are regrouped too. Unmerge separates days whose transcripts are still on disk. A merge that would loop is refused.
  • Hide from project list hides it from the list only; its spend still counts in every total and chart.
  • Logos in SVG, PNG, JPG, WebP, GIF, BMP or ICO: set from the menu, dropped on a card, dropped into a watched folder, or imported a folder at a time. A new file appears within a second.
  • Each project has a colour: one you pick (with a hex field), else its logo's dominant colour with the logo's background left out, else one from a fixed palette.
  • A project with files but no usage of its own, such as a pure replay, is left off the list.

Prices

  • Built-in rate cards for both agents, with the date they were last checked shown in the app.
  • A model the card does not know is flagged as unpriced, never counted as free, until you set its price in the app.
  • Cache rates from input fills the cache rates as 1.25x, 2x and 0.1x of input in one click, as a button rather than a default, since not every card follows that rule.
  • A whole rate card can be replaced with config\pricing.json or config\codex-pricing.json.
  • Claude Code's <synthetic> turns, which made no API call, are not counted as a model or a message.
  • Codex's long-prompt tier is kept through every sum, the archive included, so re-pricing keeps the surcharge.

History that outlives transcripts

  • Claude Code deletes transcripts after 30 days by default, and Codex prunes its own. Every refresh folds each day into a per-agent archive and the report is built from it.
  • A day is replaced only by a copy with at least as many messages: today can grow, a thinned day cannot overwrite a full one.
  • The archive keeps numbers only: tokens, cost, runtime, project ids, names and paths. No transcript content.
  • Archived days are priced again on the way out, so a rate set later reaches old days too.
  • An unreadable archive fails soft, with a warning, and is written atomically.

Lives in the tray

  • The tray icon shows today's spend for each agent; Codex's is marked API-equivalent.
  • Closing the window keeps it in the tray, unless that is turned off in Settings.
  • Refresh when transcripts change: a change is picked up within seconds, and while an agent keeps writing it is re-read at most once a minute.
  • Start at login, straight to the tray. Off until you turn it on.
  • A second launch hands over to the copy already running.
  • In the tray it drops the page it built, so it sits at the Windows UI runtime's own memory floor.

Comfortable to use

  • Dark (the default), light, or follow Windows. Light is designed on its own: white cards with shadows, accents darkened to keep text readable, a heat map that darkens with spend.
  • Zoom like a browser, 50% to 200%, with Ctrl+Plus, Ctrl+Minus, Ctrl+0 or Ctrl+mouse wheel. The page reflows rather than scrolling sideways, and the level is remembered.
  • Motion throughout: cards rise in, numbers count up, charts grow. All of it is skipped when Windows has animations turned off.
  • Set in Geist, which ships with the app.

Private by design

  • No network calls, no listener, no database, no account and no telemetry.
  • Transcripts are read as bytes and only the usage fields are pulled out; message bodies are skipped in place, never kept.
  • Everything the app writes lives in %LOCALAPPDATA%\AI Usage Native\: settings, the archive, logos and colours. Open settings folder is in Settings.

Settings files

  • settings.json: the local UTC offset for day boundaries, the first day of the week, and the idle cutoff for runtime.
  • projects.json: merges and display names by hand, for each agent.
  • Prices, colours, merges and names set in the app are saved beside these, never by rewriting your own files.
  • Every key is optional, and a broken file falls back to defaults with a warning.

Install, update, inspect

  • A self-contained zip: unzip anywhere and run AIUsage.exe. It carries its own .NET and Windows App SDK.
  • tools\Install.ps1 builds from source, adds a Start menu entry and lists the app under Installed apps. Uninstalling keeps your data unless you ask.
  • aiusage parse claude or codex prints totals and diagnostics: duplicates skipped, output recovered, files reconciled.
  • aiusage demo-data writes invented transcripts for both agents, to try the app without your own.

Built with

C# · .NET 10WinUI 3 (Windows App SDK)Utf8JsonReader Svg.SkiaH.NotifyIconGeistxUnit v3
Runs on Windows 10 1809 or later, x64. Built and tested on Windows 11.
Builds with the .NET 10 SDK. Visual Studio is not needed.
Unsigned SmartScreen asks once (More info, Run anyway). With Smart App Control on, build it from source instead.