llm-usage-metrics 0.7.0 → 0.7.2
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 +12 -7
- package/dist/index.js +411 -102
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
-
Aggregate token usage and costs from your local coding agent sessions. Supports **pi**, **codex**, **Gemini CLI**, **Droid CLI**, and **
|
|
24
|
+
Aggregate token usage and costs from your local coding agent sessions. Supports **pi**, **codex**, **Gemini CLI**, **Droid CLI**, **OpenCode**, **OpenClaw**, and **Claude Code** with zero configuration required.
|
|
25
25
|
|
|
26
26
|
## ✨ Features
|
|
27
27
|
|
|
28
|
-
- **Zero-Config Discovery** — Automatically finds `.pi`, `.codex`, `.gemini`, `.factory`, and
|
|
28
|
+
- **Zero-Config Discovery** — Automatically finds `.pi`, `.codex`, `.gemini`, `.factory`, OpenCode, OpenClaw, and Claude session data
|
|
29
29
|
- **LiteLLM Pricing** — Real-time pricing sync with offline caching support
|
|
30
30
|
- **Flexible Reports** — Daily, weekly, and monthly aggregations
|
|
31
31
|
- **Efficiency Reports** — Correlate cost/tokens with repository commit outcomes
|
|
@@ -62,6 +62,7 @@ llm-usage daily
|
|
|
62
62
|
| **Gemini CLI** | `~/.gemini/tmp/*/chats/*.json` | Automatic |
|
|
63
63
|
| **Droid CLI** | `~/.factory/sessions/**/*.settings.json` | Automatic |
|
|
64
64
|
| **OpenCode** | `~/.opencode/opencode.db` | Auto or explicit `--opencode-db` |
|
|
65
|
+
| **OpenClaw** | `~/.openclaw/agents/**/*.jsonl` | Automatic |
|
|
65
66
|
| **Claude Code** | `~/.claude/projects/**/*.jsonl` | Automatic |
|
|
66
67
|
|
|
67
68
|
OpenCode source support requires Node.js 24+ runtime with built-in `node:sqlite`.
|
|
@@ -155,6 +156,7 @@ llm-usage efficiency monthly --repo-dir /path/to/repo --source codex
|
|
|
155
156
|
llm-usage efficiency monthly --repo-dir /path/to/repo --source gemini
|
|
156
157
|
llm-usage efficiency monthly --repo-dir /path/to/repo --source droid
|
|
157
158
|
llm-usage efficiency monthly --repo-dir /path/to/repo --source opencode
|
|
159
|
+
llm-usage efficiency monthly --repo-dir /path/to/repo --source openclaw
|
|
158
160
|
llm-usage efficiency monthly --repo-dir /path/to/repo --source claude
|
|
159
161
|
```
|
|
160
162
|
|
|
@@ -179,7 +181,7 @@ llm-usage optimize monthly --provider openai --candidate-model gpt-4.1 --candida
|
|
|
179
181
|
|
|
180
182
|
```bash
|
|
181
183
|
# By source
|
|
182
|
-
llm-usage monthly --source pi,codex,gemini,droid,claude
|
|
184
|
+
llm-usage monthly --source pi,codex,gemini,droid,openclaw,claude
|
|
183
185
|
|
|
184
186
|
# By provider
|
|
185
187
|
llm-usage monthly --provider openai
|
|
@@ -191,13 +193,13 @@ llm-usage monthly --model claude
|
|
|
191
193
|
llm-usage monthly --source opencode --provider openai --model gpt-4.1
|
|
192
194
|
```
|
|
193
195
|
|
|
194
|
-
Use `--source` to scope where events came from (`pi`, `codex`, `gemini`, `droid`, `opencode`, `claude`), and `--provider` to scope the billing entity behind those events.
|
|
196
|
+
Use `--source` to scope where events came from (`pi`, `codex`, `gemini`, `droid`, `opencode`, `openclaw`, `claude`), and `--provider` to scope the billing entity behind those events.
|
|
195
197
|
|
|
196
198
|
### Custom Paths
|
|
197
199
|
|
|
198
200
|
```bash
|
|
199
201
|
# Custom directories
|
|
200
|
-
llm-usage daily --source-dir pi=/path/to/pi --source-dir codex=/path/to/codex --source-dir gemini=/path/to/.gemini --source-dir droid=/path/to/.factory/sessions --source-dir claude=/path/to/.claude/projects
|
|
202
|
+
llm-usage daily --source-dir pi=/path/to/pi --source-dir codex=/path/to/codex --source-dir gemini=/path/to/.gemini --source-dir droid=/path/to/.factory/sessions --source-dir openclaw=/path/to/.openclaw/agents --source-dir claude=/path/to/.claude/projects
|
|
201
203
|
|
|
202
204
|
# Explicit Gemini/Droid/Claude/OpenCode paths
|
|
203
205
|
llm-usage daily --gemini-dir /path/to/.gemini
|
|
@@ -214,6 +216,9 @@ llm-usage monthly --pricing-offline
|
|
|
214
216
|
|
|
215
217
|
# Continue even if pricing fetch fails
|
|
216
218
|
llm-usage monthly --ignore-pricing-failures
|
|
219
|
+
|
|
220
|
+
# Override per-model pricing from a local JSON file
|
|
221
|
+
llm-usage monthly --pricing-overrides ./pricing-overrides.json
|
|
217
222
|
```
|
|
218
223
|
|
|
219
224
|
## 🧪 Production Benchmarks
|
|
@@ -313,8 +318,8 @@ See full environment variable reference in the [documentation](https://ayagmar.g
|
|
|
313
318
|
The CLI performs lightweight update checks with smart defaults:
|
|
314
319
|
|
|
315
320
|
- 1-hour cache TTL
|
|
316
|
-
- Fresh cached update results are used immediately
|
|
317
|
-
- Stale or missing cache
|
|
321
|
+
- Fresh cached update results are used immediately without any network call
|
|
322
|
+
- Stale or missing cache triggers a bounded fetch (default 1s timeout) so the update prompt stays consistent across commands, instead of silently skipping the run that refreshes the cache
|
|
318
323
|
- Skipped for `--help`, `--version`, `npx`, and direct source/development runs
|
|
319
324
|
- Prompts only in interactive TTY sessions
|
|
320
325
|
|