Repository navigation
Releases
v0.6.0 — twelve sources, five of them ccusage cannot read
Twelve sources, five of them only agentledger can read
- WorkBuddy (new) — 487 records, 40.77M tokens, a model on every record
- Lingma (new) — 43 records, 2.76M tokens, 阿里通义灵码
- CodeBuddy CN — 362 records, 24.10M tokens
And three wrong numbers fixed
--pathon a WorkBuddy file fell through to the Claude Code parser: the whole prompt priced as fresh input, the cached part charged twice, every timestamp null--pathon a file a lane already read counted it twice (1,462 records became 1,574)- the docs pipeline published a total of $1169 while the tool said $1227 — the gate only checked the token column
Also
node:sqliteis flagged on Node 22.5–23.7, and importing it THROWS there — so five of the twelve lanes read nothing and the report looked complete. The tool now restarts itself with--experimental-sqlitewhen the module is unavailable- billing blocks,
--timezone,--until,by-week,by-month
Install:
brew install garyleelty/agentledger/agentledgeror from the tarball on this release:
npm install -g https://github.com/garyleelty/agentledger/releases/download/v0.6.0/agentledger-cli-0.6.0.tgzv0.5.0
Ten agents now, and the windows your subscription actually bills in.
What is new
Billing blocks (agentledger blocks) — the rolling windows a
subscription quota resets in, with the active window's burn rate and
projection. ccusage has this as a Claude-Code-only report; this computes
it across all ten lanes, because a quota window is a property of the
subscription, not of the log format.
CodeBuddy CN — a tenth agent, and a third one only agentledger can
read. ccusage has no adapter for it at all (its "codebuff" is Manicode, a
different product). Its usage lives in four stores that have to be
joined — the extension log carries the token buckets, the history index
the clock, the message files the model, the sessions database the
working directory. 24.10M tokens on this machine.
One day boundary, not two. by-day counted days in UTC while
budget and statusline started the day at local midnight, so for a
user 8 hours from UTC they disagreed about what "today" meant. One
helper serves all three now, and --timezone picks the zone.
--until — the missing half of the date range, inclusive of the day
it names. 2026-02-30 is an error, not a rollover.
by-week and by-month — the daily report, rolled up. Weeks start
on Monday, in your zone.
--json returns the breakdown the command names. by-model --json
used to return all 18,017 records and no model breakdown, so a script
had to group them itself — the same work the command had already done,
thrown away on the way out. Six commands had this.
The agent's own cost, next to agentledger's estimate. Claude Code
writes its own costUSD on the log line; ccusage picks one of the two
numbers, this prints both and the difference between them. The stored
cost never prices anything — a test pins that the priced total does not
change when a cost field appears.
The statusline shows the active block — the gap this project used
to concede outright.
Install
brew install garyleelty/agentledger/agentledgeror, from a release tarball with no npm account and no registry:
npm install -g https://github.com/garyleelty/agentledger/releases/download/v0.5.0/agentledger-cli-0.5.0.tgzStill true
Zero dependencies. No network call of any kind — the input is your
entire coding history and it never leaves the machine. Node 22.5+.
And still true
Ten agents against ccusage's eighteen, and three of those ten are ones
ccusage cannot read at all.
agentledger 0.4.0
Install (no npm account needed)
npm install -g https://github.com/garyleelty/agentledger/releases/download/v0.4.0/agentledger-cli-0.4.0.tgzOr run it once with npx --package=git+https://github.com/garyleelty/agentledger.git agentledger.
The tarball below is attached by the release workflow using the repo's own token — agentledger-cli is still not on the npm registry, so this is the direct-download path.
What's new since 0.3.0
Three more sources (6 → 9). OpenClaw, pi-agent, and Cherry Studio.
- OpenClaw and pi-agent are token-identical to ccusage 20.0.34 on the same files. OpenClaw: input 28,319,456 / output 614,261 / cacheRead 2,457,344 — every bucket exact. Getting there required reading its archived
<uuid>.jsonl.reset.<ts>and.jsonl.deleted.<ts>siblings, which hold 127 of 959 usage rows and 2.03M input tokens that a bare.jsonlmatcher silently drops. - Cherry Studio is a lane ccusage has no adapter for, covering June and July sessions no other source reads. It is also the only source that can double-count, because it is a GUI hosting other agents and writes a usage row for requests the hosted agent also logs. That is handled explicitly: 3 of its 32 rows are the same request as a pi-agent row (17,858 tokens), and the agent's own log wins.
Two pricing errors fixed with vendor-consensus evidence, not guesses:
glm-4.7:cloudwas on the $3/$15 default — 2.08M tokens, $6.46 of pure placeholder. Six LiteLLM vendor rows agree exactly on $0.60/$2.20.deepseek-v4-prowas on the default too. Eleven of LiteLLM's 27 rows agree exactly on $1.32/$3.96, and that is the cluster the bare id itself carries.
The pricing audit now checks 29 of 33 entries, up from 27.
The honest comparison, measured not argued. crosscheck runs both tools against the same logs and diffs every bucket. Token counts agree exactly on all six comparable lanes. Where they differ it is stated: ccusage reports $0.00 for every model in its OpenClaw lane (two are missing from its embedded table), and it excludes reasoning tokens from output where this tool bills them. DSH — 1.59B tokens here, more than every other agent combined — is a source ccusage cannot read at all.
One bug class worth naming: a test that asserted a hardcoded source count of 6 was already stale when the seventh source shipped. It is derived from the code now.
Verifying
npm test # 138 tests
node tools/crosscheck.mjs --ccusage /path/to/ccusage # vs the incumbent
python3 tools/audit_pricing.py litellm.json # vs the LiteLLM dbZero dependencies, Node 22.5+, no network calls of any kind.
agentledger 0.3.0
Install (no npm account needed)
npm install -g https://github.com/garyleelty/agentledger/releases/download/v0.3.0/agentledger-cli-0.3.0.tgzThe tarball below is attached by the release workflow using the repo's own token — agentledger-cli is still not on the npm registry, so this is the direct-download path.
What's new since 0.2.0
Sixth source: DSH (DeepSeek Harness). ~/.dsh/sessions/*/session.v4.jsonl.zstd. These sessions are multi-frame zstd — one frame per append — and Node's zstdDecompressSync reads only the first, silently yielding 238 bytes of a 776 kB session and zero records. The parser splits on the frame magic and decompresses each independently. No other tool reads these logs.
Unknown-price disclosure. A model with no built-in price is billed at a documented default and the report now says so: the model names, record counts, the dollar share of the total, and how to fix it. This mattered immediately — on the maintainer's machine 8 models were unpriced and $755 of a $1000 total was a placeholder. That number now travels with its caveat through summary, aggregate, and both digest renderers, so a published page cannot assert a total it cannot back.
prices --template. Turns that warning into a one-step fix: emits an override file naming exactly the models your ledger could not price, each with its token volume, with null placeholders (never invented rates).
--prices <file> (0.2.x): override any model's rates; partial entries merge over the built-in row.
statusline (0.2.x): one line for Claude Code's status bar, preferring the host's own session cost over an estimate.
Also
- Pricing table cross-checked against the live LiteLLM database by a weekly CI job; 25 of 30 entries reconcile, the rest are reported as unchecked rather than trusted.
- 97 tests, all hermetic (committed fixtures — the suite cannot pass by measuring nothing).
- Docs figures are generated from a committed sample and CI fails if they drift.
MIT. Zero dependencies. No network calls, ever.
v0.1.0 — first public release
agentledger — local-first cost ledger for AI coding agents
Reads the session logs your agents already write and turns them into tokens and dollars.
$ npx agentledger-cli
agentledger — 73 session files scanned
Metric Tokens Est. cost
───────────── ─────── ─────────
Input tokens 18.30M $20.74
Cache read 418.01M $43.58
Output tokens 1.47M $10.66
TOTAL 437.77M $74.98
Agent Tokens Est. cost Records
─────────── ─────── ───────── ───────
codex 219.58M $59.31 3053
claude-code 218.19M $15.67 3531
(real output from the machine it was written on)
Highlights
- Local only — reads
~/.claude/projects,~/.codex/sessions,~/.gemini/tmp. No network call anywhere in the codebase. - Cache-aware pricing — cache reads and cache writes are billed separately from fresh input, which most dashboards get wrong.
- Zero dependencies — Node 18+ and stdlib only. ~700 lines, auditable in one sitting.
- Fast — full scan of 400M+ tokens in about a second.
Commands
summary (default) · by-model · by-day · sessions · watch · prices · json · sources
Privacy
Opens log files read-only and writes nothing. No telemetry, no update check, no account.
MIT licensed and free forever.