llm-usage-metrics 0.8.1 → 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 +27 -11
  2. package/dist/index.js +23475 -12460
  3. package/package.json +6 -3
package/README.md CHANGED
@@ -29,18 +29,23 @@ The CLI parses session content on your machine. It discovers standard source loc
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
  ```
@@ -157,10 +167,10 @@ The pricing request never includes session content. See [Pricing](https://ayagma
157
167
 
158
168
  ## Local event ledger
159
169
 
160
- 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`:
161
171
 
162
172
  ```bash
163
- llm-usage monthly --history
173
+ llm-usage monthly --no-history
164
174
  ```
165
175
 
166
176
  `prune` is a dry run unless you pass `--apply`:
@@ -175,14 +185,17 @@ Deleting the ledger also deletes retained history. Read [Caching](https://ayagma
175
185
  ## Output
176
186
 
177
187
  ```bash
178
- llm-usage daily --json
188
+ llm-usage daily --all --json
179
189
  llm-usage daily --markdown
190
+ llm-usage daily --compact
180
191
  llm-usage monthly --share
181
192
  ```
182
193
 
183
- 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.
184
195
 
185
- 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.
186
199
 
187
200
  ## Performance
188
201
 
@@ -201,9 +214,12 @@ pnpm run format:check
201
214
  pnpm run build
202
215
  ```
203
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
+
204
219
  Site commands:
205
220
 
206
221
  ```bash
222
+ pnpm run site:docs:generate
207
223
  pnpm run site:check
208
224
  pnpm run site:build
209
225
  pnpm run site:dev