llm-usage-metrics 0.4.3 → 0.5.1
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 +28 -9
- package/dist/index.js +7260 -5626
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ Aggregate token usage and costs from your local coding agent sessions. Supports
|
|
|
30
30
|
- **Flexible Reports** — Daily, weekly, and monthly aggregations
|
|
31
31
|
- **Efficiency Reports** — Correlate cost/tokens with repository commit outcomes
|
|
32
32
|
- **Optimize Reports** — Counterfactual candidate-model pricing against observed token mix
|
|
33
|
+
- **Trends Reports** — Daily cost or token trend views with combined or per-source output
|
|
33
34
|
- **Multiple Outputs** — Terminal tables, JSON, or Markdown
|
|
34
35
|
- **Smart Filtering** — By source, billing provider, model, and date ranges
|
|
35
36
|
|
|
@@ -97,6 +98,21 @@ llm-usage monthly --per-model-columns
|
|
|
97
98
|
llm-usage monthly --share
|
|
98
99
|
```
|
|
99
100
|
|
|
101
|
+
### Trends
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Last 30 local days of cost by default
|
|
105
|
+
llm-usage trends
|
|
106
|
+
|
|
107
|
+
# Token trends for the last 7 days
|
|
108
|
+
llm-usage trends --metric tokens --days 7
|
|
109
|
+
|
|
110
|
+
# Per-source trends in JSON
|
|
111
|
+
llm-usage trends --by-source --json
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Trends is terminal-first and supports `--json`. It does not support `--markdown` or `--share`.
|
|
115
|
+
|
|
100
116
|
### Efficiency Reports
|
|
101
117
|
|
|
102
118
|
```bash
|
|
@@ -119,8 +135,7 @@ Efficiency reports are repo-attributed: usage events are mapped to a Git reposit
|
|
|
119
135
|
|
|
120
136
|
- `Commits`, `+Lines`, `-Lines`, `ΔLines` come from local Git shortstat outcomes (for your configured Git author).
|
|
121
137
|
- `Input`, `Output`, `Reasoning`, `Cache Read`, `Cache Write`, `Total`, and `Cost` come from repo-attributed usage events.
|
|
122
|
-
- `
|
|
123
|
-
- `Non-Cache/Commit` uses `(Input + Output + Reasoning) / Commits` and excludes cache read/write tokens.
|
|
138
|
+
- `Tokens/Commit` uses `(Input + Output + Reasoning) / Commits` and excludes cache read/write tokens.
|
|
124
139
|
- `$/Commit` uses `Cost / Commits`.
|
|
125
140
|
- `$/1k Lines` uses `Cost / (ΔLines / 1000)`.
|
|
126
141
|
- `Commits/$` uses `Commits / Cost` (shown only when `Cost > 0`).
|
|
@@ -275,12 +290,14 @@ pnpm run perf:production-benchmark -- \
|
|
|
275
290
|
|
|
276
291
|
### Environment Variables
|
|
277
292
|
|
|
278
|
-
| Variable | Description
|
|
279
|
-
| -------------------------------- |
|
|
280
|
-
| `LLM_USAGE_SKIP_UPDATE_CHECK` | Skip update check (`1`)
|
|
281
|
-
| `
|
|
282
|
-
| `
|
|
283
|
-
| `
|
|
293
|
+
| Variable | Description |
|
|
294
|
+
| -------------------------------- | ---------------------------------- |
|
|
295
|
+
| `LLM_USAGE_SKIP_UPDATE_CHECK` | Skip update check (`1`) |
|
|
296
|
+
| `LLM_USAGE_UPDATE_CACHE_SCOPE` | Update cache scope |
|
|
297
|
+
| `LLM_USAGE_PRICING_CACHE_TTL_MS` | Pricing cache duration |
|
|
298
|
+
| `LLM_USAGE_PARSE_MAX_PARALLEL` | Max parallel file parses (`1-64`) |
|
|
299
|
+
| `LLM_USAGE_PARSE_CACHE_ENABLED` | Enable parse cache (`1/0`) |
|
|
300
|
+
| `LLM_USAGE_PROFILE_RUNTIME` | Emit runtime profiling diagnostics |
|
|
284
301
|
|
|
285
302
|
Parse cache is source-sharded on disk (`parse-file-cache.<source>.json`) so source-scoped runs avoid loading unrelated cache blobs.
|
|
286
303
|
|
|
@@ -291,7 +308,9 @@ See full environment variable reference in the [documentation](https://ayagmar.g
|
|
|
291
308
|
The CLI performs lightweight update checks with smart defaults:
|
|
292
309
|
|
|
293
310
|
- 1-hour cache TTL
|
|
294
|
-
-
|
|
311
|
+
- Fresh cached update results are used immediately
|
|
312
|
+
- Stale or missing cache refreshes in the background instead of blocking report execution
|
|
313
|
+
- Skipped for `--help`, `--version`, `npx`, and direct source/development runs
|
|
295
314
|
- Prompts only in interactive TTY sessions
|
|
296
315
|
|
|
297
316
|
Disable with:
|