llm-usage-metrics 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +30 -13
  2. package/dist/index.js +24235 -12768
  3. package/package.json +22 -40
package/README.md CHANGED
@@ -23,24 +23,29 @@
23
23
  <a href="./CONTRIBUTING.md">Contributing</a>
24
24
  </p>
25
25
 
26
- `llm-usage-metrics` reads local session data from 16 AI coding tools and converts it into one normalized usage history. Use it to review tokens and estimated cost, compare periods, find expensive sessions, correlate usage with local Git activity, or export the result.
26
+ `llm-usage-metrics` reads local session data from 17 AI coding tools and converts it into one normalized usage history. Use it to review tokens and estimated cost, compare periods, find expensive sessions, correlate usage with local Git activity, or export the result.
27
27
 
28
28
  The CLI parses session content on your machine. It discovers standard source locations and includes a bundled pricing snapshot, so the first report can run without configuration or network access.
29
29
 
30
30
  ## Quick start
31
31
 
32
- Requires Node.js 24 or newer.
32
+ Requires Node.js 22.16+ or 24+ (Node 23 lacks the SQLite busy timeout the ledger uses).
33
33
 
34
34
  ```bash
35
35
  # Run without installing
36
- npx --yes llm-usage-metrics@latest daily
36
+ npx --yes llm-usage-metrics@latest
37
37
 
38
- # Or install the llm-usage command
38
+ # Or install it: the package provides `llm-usage` and the alias `llm-usage-metrics`
39
39
  npm install -g llm-usage-metrics
40
- llm-usage daily
40
+ llm-usage
41
+
42
+ # Optional: tab completion (bash shown; zsh and fish work the same way)
43
+ echo 'source <(llm-usage completion bash)' >> ~/.bashrc
41
44
  ```
42
45
 
43
- If the report is empty, check source discovery:
46
+ With no command, `llm-usage` prints cost and tokens for today, the last 7 days, and month to date, a month-end projection (checked against `monthlyBudgetUsd` when you set one), what prompt caching saved you this month, then your current and longest streak, best day, and a year-long activity heatmap. `llm-usage daily` breaks the last 7 days down by day and source, and `llm-usage weekly` covers the last 8 weeks; add `--since YYYY-MM-DD` or `--all` for older usage.
47
+
48
+ If the report is empty, check source discovery. `doctor` lists the paths each source searched and marks it found, not installed, or unparseable:
44
49
 
45
50
  ```bash
46
51
  llm-usage doctor
@@ -50,6 +55,7 @@ llm-usage doctor
50
55
 
51
56
  | Question | Command |
52
57
  | --------------------------------------------------------- | ----------------------------------------- |
58
+ | What did I spend today, this week, and this month? | `llm-usage` |
53
59
  | How much did I use by day, week, or month? | `llm-usage daily`, `weekly`, `monthly` |
54
60
  | How did one period change from another? | `llm-usage compare` |
55
61
  | Which conversations or repositories used the most? | `llm-usage session` |
@@ -57,6 +63,7 @@ llm-usage doctor
57
63
  | How does repo-attributed usage line up with Git activity? | `llm-usage efficiency monthly` |
58
64
  | What would the same token mix cost on another model? | `llm-usage optimize monthly` |
59
65
  | What did the year add up to? | `llm-usage wrapped` |
66
+ | What can my status bar show? | `llm-usage statusline` |
60
67
  | How do I get the raw normalized events out? | `llm-usage events` |
61
68
  | Which sources and local stores are healthy? | `llm-usage doctor` |
62
69
  | Which departed files can leave the event ledger? | `llm-usage prune` |
@@ -69,7 +76,7 @@ Common examples:
69
76
  # A chosen calendar range
70
77
  llm-usage monthly --since 2026-06-01 --until 2026-06-30
71
78
 
72
- # Current local month compared with the previous month
79
+ # Current month to date compared with the same days of the previous month
73
80
  llm-usage compare
74
81
 
75
82
  # Ten highest-cost conversations
@@ -87,6 +94,9 @@ llm-usage optimize monthly \
87
94
  --candidate-model gpt-4.1 \
88
95
  --candidate-model gpt-5-codex
89
96
 
97
+ # One line for the Claude Code status line, tmux, or starship
98
+ llm-usage statusline
99
+
90
100
  # Normalized events as JSONL, e.g. total tokens per line via jq
91
101
  llm-usage events --since 2026-06-01 | jq '.totalTokens'
92
102
  ```
@@ -111,6 +121,7 @@ llm-usage events --since 2026-06-01 | jq '.totalTokens'
111
121
  | RooCode | task JSON |
112
122
  | KiloCode | task JSON |
113
123
  | Antigravity | SQLite |
124
+ | DeepSeek Harness | JSONL + zstd |
114
125
 
115
126
  Each source adapter owns discovery and source-specific token normalization. Reports operate on the same `UsageEvent` shape after parsing. The [source documentation](https://ayagmar.github.io/llm-usage-metrics/sources/) lists default paths, override flags, and adapter-specific semantics.
116
127
 
@@ -156,10 +167,10 @@ The pricing request never includes session content. See [Pricing](https://ayagma
156
167
 
157
168
  ## Local event ledger
158
169
 
159
- A SQLite event ledger stores normalized events and parse diagnostics. Unchanged files can skip parsing on later runs. The ledger also supports retained history for files that have left the disk:
170
+ A SQLite event ledger stores normalized events and parse diagnostics. Unchanged files can skip parsing on later runs. Reports also include retained history for files that have left the disk (Claude Code, for example, deletes old transcripts), with moved or copied files suppressed. Leave it out with `--no-history`:
160
171
 
161
172
  ```bash
162
- llm-usage monthly --history
173
+ llm-usage monthly --no-history
163
174
  ```
164
175
 
165
176
  `prune` is a dry run unless you pass `--apply`:
@@ -174,18 +185,21 @@ Deleting the ledger also deletes retained history. Read [Caching](https://ayagma
174
185
  ## Output
175
186
 
176
187
  ```bash
177
- llm-usage daily --json
188
+ llm-usage daily --all --json
178
189
  llm-usage daily --markdown
190
+ llm-usage daily --compact
179
191
  llm-usage monthly --share
180
192
  ```
181
193
 
182
- Report data goes to `stdout`. Discovery, pricing, config, and skipped-row diagnostics go to `stderr`, which keeps JSON and Markdown safe to redirect. JSON output is wrapped in a versioned envelope: `{ "schemaVersion": 1, "report": "usage", "data": ... }`. Scripts written against pre-0.8.0 JSON should follow the [migration guide](https://ayagmar.github.io/llm-usage-metrics/migrating-to-0-8/).
194
+ Terminal tables fit the terminal width: on a narrow terminal, token counts are abbreviated and less-used columns are hidden, with a `stderr` note saying what was left out. `--compact` asks for the short table directly.
183
195
 
184
- Terminal, JSON, and Markdown availability varies by report. Usage, trends, wrapped, efficiency, and optimize can write supported share SVGs. The [output guide](https://ayagmar.github.io/llm-usage-metrics/output-formats/) contains the format matrix and file names.
196
+ Report data goes to `stdout`. Diagnostics go to `stderr` as one summary line plus any warnings, which keeps JSON and Markdown safe to redirect; `--quiet` keeps only warnings and `--verbose` adds per-source and skipped-row detail. JSON output is wrapped in a versioned envelope: `{ "schemaVersion": 1, "report": "usage", "data": ... }`. Scripts written against pre-0.8.0 JSON should follow the [migration guide](https://ayagmar.github.io/llm-usage-metrics/migrating-to-0-8/).
197
+
198
+ Terminal, JSON, and Markdown availability varies by report. Summary, usage, compare, trends, wrapped, efficiency, and optimize can write a 1200×630 share card: an SVG plus an HTML page that shows it in dark and light and exports a PNG in your browser. `--share --no-open` writes the files without opening the page. The [output guide](https://ayagmar.github.io/llm-usage-metrics/output-formats/) contains the format matrix and file names.
185
199
 
186
200
  ## Performance
187
201
 
188
- The repository publishes absolute cold and warm runtimes on real local corpora. The comparison includes the runs where `ccusage` is faster and the warm Claude run where the event ledger is faster. It also records the machine, commands, cache state, dataset size, and five-run distribution.
202
+ The repository publishes direct-process and launcher-inclusive runtimes on stable snapshots of real local corpora. The current direct-process comparison shows `ccusage` ahead in every measured daily JSON cell; a separate monthly terminal check shows why timing `npx ccusage@...` can appear much slower than an installed `llm-usage` command. The benchmark records the machine, exact commands, application state, dataset size, and eight-run summary statistics.
189
203
 
190
204
  Read and reproduce the [benchmark](https://ayagmar.github.io/llm-usage-metrics/benchmarks/) before applying its results to another workload.
191
205
 
@@ -200,9 +214,12 @@ pnpm run format:check
200
214
  pnpm run build
201
215
  ```
202
216
 
217
+ The website has a [docs overview](https://ayagmar.github.io/llm-usage-metrics/docs/) and a [report chooser](https://ayagmar.github.io/llm-usage-metrics/reports/) for finding the right command. Its landing page and source navigation use the CLI source registry; regenerate CLI and security references after behavior changes.
218
+
203
219
  Site commands:
204
220
 
205
221
  ```bash
222
+ pnpm run site:docs:generate
206
223
  pnpm run site:check
207
224
  pnpm run site:build
208
225
  pnpm run site:dev