llm-usage-metrics 0.12.0 → 0.13.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.
- package/README.md +17 -6
- package/dist/index.js +18119 -16262
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ echo 'source <(llm-usage completion bash)' >> ~/.bashrc
|
|
|
54
54
|
|
|
55
55
|
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, a note when a day of the last 7 cost at least $1 and at least 3 times your median active day, 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.
|
|
56
56
|
|
|
57
|
-
If the report is empty, check source discovery. `doctor` lists the paths
|
|
57
|
+
If the report is empty, check source discovery. `doctor` marks each source found, not installed, or unparseable and lists the paths it searched (`--verbose` adds the paths of sources that are not installed):
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
llm-usage doctor
|
|
@@ -110,7 +110,7 @@ llm-usage session --id 486c3261 --timeline
|
|
|
110
110
|
llm-usage tools --by-source
|
|
111
111
|
|
|
112
112
|
# Cost per project, and daily rows split by project
|
|
113
|
-
llm-usage projects
|
|
113
|
+
llm-usage projects
|
|
114
114
|
llm-usage daily --by-repo
|
|
115
115
|
|
|
116
116
|
# Estimated 5-hour blocks for Claude Code today, including the active one
|
|
@@ -143,7 +143,7 @@ llm-usage events --since 2026-06-01 | jq '.totalTokens'
|
|
|
143
143
|
| Source | Local format | Real logs |
|
|
144
144
|
| ---------------------- | ------------- | --------- |
|
|
145
145
|
| pi | JSONL | checked |
|
|
146
|
-
| codex | JSONL
|
|
146
|
+
| codex | JSONL + zstd | checked |
|
|
147
147
|
| Gemini CLI | JSON | checked |
|
|
148
148
|
| Droid CLI | settings JSON | not yet |
|
|
149
149
|
| OpenCode | SQLite | checked |
|
|
@@ -191,7 +191,7 @@ The config precedence order is CLI flags, environment variables, TOML config, th
|
|
|
191
191
|
|
|
192
192
|
## Pricing
|
|
193
193
|
|
|
194
|
-
The CLI keeps a valid cost supplied by a source. When a source has no cost, it estimates one from LiteLLM pricing. A source that logs `$0` for a request that used tokens gets an estimate too, and
|
|
194
|
+
The CLI keeps a valid cost supplied by a source. When a source has no cost, it estimates one from LiteLLM pricing. A source that logs `$0` for a request that used tokens gets an estimate too, and `--verbose` names those sources on stderr. `--cost-mode explicit` reports logged costs only and keeps `$0`; `--cost-mode estimated` prices every event from its tokens.
|
|
195
195
|
|
|
196
196
|
Pricing loads from a fresh cache, a network refresh, a stale cache, or the bundled snapshot. Use offline mode to skip the network request:
|
|
197
197
|
|
|
@@ -217,9 +217,10 @@ A SQLite event ledger stores normalized events and parse diagnostics. Unchanged
|
|
|
217
217
|
llm-usage monthly --no-history
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
`prune` is a dry run unless you pass `--apply
|
|
220
|
+
`prune` is a dry run unless you pass `--apply`. Run it without a selector to count what each selector would pick:
|
|
221
221
|
|
|
222
222
|
```bash
|
|
223
|
+
llm-usage prune
|
|
223
224
|
llm-usage prune --suppressed
|
|
224
225
|
llm-usage prune --departed-before 2026-01-01 --apply
|
|
225
226
|
```
|
|
@@ -239,6 +240,16 @@ llm-usage # the summary splits this month's cost by m
|
|
|
239
240
|
|
|
240
241
|
A session that reached both machines (a copied or synced `~/.claude`) is counted once. See [Multiple machines](https://ayagmar.github.io/llm-usage-metrics/machines/).
|
|
241
242
|
|
|
243
|
+
## Use with coding agents
|
|
244
|
+
|
|
245
|
+
The repository ships an agent skill that teaches Claude Code, Codex, Pi, and other agents which `llm-usage` command answers a spend or usage question, and to read the `--json` output instead of guessing. Install it with the [skills CLI](https://github.com/vercel-labs/skills):
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
npx skills add ayagmar/llm-usage-metrics --skill llm-usage-metrics --agent claude-code
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Use `--agent codex`, `--agent pi`, or another agent id, and `-g` to install it for all projects. See [Use with coding agents](https://ayagmar.github.io/llm-usage-metrics/agents/).
|
|
252
|
+
|
|
242
253
|
## Output
|
|
243
254
|
|
|
244
255
|
```bash
|
|
@@ -251,7 +262,7 @@ llm-usage weekly --last 1 --no-cost
|
|
|
251
262
|
|
|
252
263
|
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. When no table fits, as on a phone, each row is listed as labelled values instead. `--compact` asks for the short table directly. `--last N` covers the last N days, weeks, or months, counting the current one, and `--no-cost` leaves spend out of tables and share reports.
|
|
253
264
|
|
|
254
|
-
Report data goes to `stdout`. Diagnostics go to `stderr
|
|
265
|
+
Report data goes to `stdout`. Diagnostics go to `stderr`, which keeps JSON and Markdown safe to redirect. By default that is warnings and the notes that explain the numbers, such as the `~` cost marker; `--quiet` keeps only warnings, and `--verbose` adds the scan summary, history and machine notes, and 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/upgrading/0-8/).
|
|
255
266
|
|
|
256
267
|
<picture>
|
|
257
268
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ayagmar/llm-usage-metrics/master/site/src/assets/screenshots/share-daily-dark.webp">
|