Fynnland

cost-ledger

A cost ledger across all chats, by day, project and model.

Overview

What it is about

Claude Code shows the cost of a chat. cost-ledger keeps a ledger of all of them: After every answer, the mod records what the chat cost, how many tokens went to which model and what the calls of other mods cost. This builds a history you can query.

Claude Code is a product of Anthropic. This mod is not from Anthropic.

What /ledger shows

The output of /ledger on a dark background, as of Oct 27 14:20. At the top one sentence on the API value and the totals: today $6.82 in 1 chat, 7 days $43.33, 30 days $95.03, all time $115.93 in 21 chats. Below it the subscription line “Plan Max 5x since Oct 14: $73.63 API value = 0.7× the $100.00” and the limits 33% for five hours and 12% for the week. Then the last 14 days as orange bars, with Oct 21 at $12.99 marked as the highest. At the bottom left the projects rezeptbox, demo-shop, blog-umbau and Script runs as bars, on the right the five most expensive chats with project and date, at the top “Search with error tolerance” at $14.09. At the very bottom the cost of the mod calls and the line “Here: rezeptbox $57.46 in total, this chat 11.9%”.
/ledger shows totals, history, projects and the most expensive chats at a glance (recreated view).
The “Models · 30 days” view of cost-ledger: a ring with $95.03 in the middle, almost entirely orange, with a small blue piece and a very narrow green piece. Below it three rows: Opus 5.5 at 88%, $83.46 and 587 answers, Sonnet 5.5 at 11%, $10.86 and 77 answers, Haiku 5.5 at 1%, $0.71 and 79 answers, each with the tokens for input, output and cache.
With /ledger models, a ring shows which model makes up how much of the API value (recreated view).

With /ledger here you see what the project of this chat has cost so far and what share of it the chat has. In the desktop app a ring shows the share, and next to it the project's amount in large type. If limit-bars is installed too, it shows the same numbers as a small cost ring above the prompt.

A box with a gray ring on the left, filled orange to 11.9%, the number in the middle. To the right of it “rezeptbox · 9 chats · API value total”, large $57.46 and below it “this chat $6.82 · 1 day active”. At the bottom the line “since Sep 14, 2026 (recording) · this device only” and a note that on a subscription the API value counts against the quota and is not paid.
/ledger here shows what this project has cost and what share this chat has (recreated view).

With /ledger limits you see the API value in the current 5-hour window, in the week and in your subscription month. An estimate for usage outside the ledger comes with it, for example through claude.ai or the phone. You enter your plan yourself with /ledger plan: Pro, Max, Ultra, Team or Enterprise, plus the billing day. Without a price the list price applies (Max $100, Ultra $200, Pro $20); for Team and Enterprise you give the price yourself. The old names max5 and max20 still work and become Max and Ultra. /ledger help lists all commands and your settings. /ledger language de or en switches all installed fynn-mods to German or English at once. Out of the box, the mods speak English.

The “cost-ledger · limits” view. The 5-hour window is at 33% and $6.82, projected about $20.67 for 100%, plus the estimate “outside the ledger ≈ 4% of 33%”. Below it the week at 12% and $18.18, the subscription month with $73.63 API value for a $100.00 plan, the last ten 5-hour windows as green bars with amount and percent, the average “100% ≈ $22.62” and a footer with notes on the estimates.
/ledger limits converts percent into API value and estimates what ran outside the ledger (recreated view).

Several devices

With /ledger sync and a folder you merge the ledgers of several devices, for example through a folder you already sync between computers anyway. The sync file holds amounts, model IDs, session IDs and, since version 0.8.0, the last folder name of each project, so that chats from other devices count toward the same project. Paths, Git remotes and chat titles are not in it. You can also enter the folder and a device name on the plugin's settings page; there only the path is saved, and a missing folder is created only by /ledger sync with the folder.

Settings

Plan, billing day, price, sync folder and device name are on the plugin's settings page: in the desktop app under Settings → Plugins → cost-ledger → Settings, in the terminal with /config or /plugin configure cost-ledger. /ledger plan and /ledger sync change the same values. What earlier versions saved, the mod takes over once at the first start.

In the terminal a command applies at once. In the desktop app it applies in the current chat at once, in other open chats after /reload-plugins or in the next chat. The settings stay on each computer, like the ledger.

What the mod reads and does

cost-ledger does not call a model and uses no network. Locally it stores costs, tokens, limit windows, titles and a project name. It reads and writes files only when you turn on the sync: it reads the files of the other devices in the chosen folder and writes only its own. To limit-bars it passes only what this chat and this project have cost, plus the project's folder name, since when it has been recording and on how many devices; no paths, titles or chat contents. For the language switch it changes the “language” setting of the eight fynn-mods, for /ledger plan and /ledger sync only its own settings; it leaves other plugins alone. In the desktop app it calls the claude CLI for this, only with “claude plugin list” and “claude plugin configure”. If the saved settings still hold an old plan name (max5, max20), it switches it to Max or Ultra once and shows a single notice for that.

Installation

You need Claude Code in a version that supports mods (tested with 2.1.325, minimum version 2.1.318; the other fynn-mods need 2.1.323). Two commands:

  1. claude plugin marketplace add FynnXland/fynn-mods
  2. claude plugin install cost-ledger@fynn-mods

The mod is free and under the MIT license. This description refers to version 0.12.5. The amounts are values at API prices, not a bill.

Part of fynn-mods

cost-ledger is one of eight mods that fit together. They pass small values to each other, never text from the chat, and six share the band above the prompt.

How the eight mods work together