llm-usage-metrics 0.1.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/LICENSE +21 -0
- package/README.md +103 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1415 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abdeslam Yassine Agmar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# llm-usage-metrics
|
|
2
|
+
|
|
3
|
+
CLI to aggregate local LLM usage from:
|
|
4
|
+
|
|
5
|
+
- `~/.pi/agent/sessions/**/*.jsonl`
|
|
6
|
+
- `~/.codex/sessions/**/*.jsonl`
|
|
7
|
+
|
|
8
|
+
Reports are available for daily, weekly (Monday-start), and monthly periods.
|
|
9
|
+
|
|
10
|
+
Project documentation is available in [`docs/`](./docs/README.md).
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g llm-usage-metrics
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or run without global install:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx llm-usage-metrics daily
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Daily report (default terminal table)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
usage daily
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Weekly report with custom timezone
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
usage weekly --timezone Europe/Paris
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Monthly report with date range
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
usage monthly --since 2026-01-01 --until 2026-01-31
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Markdown output
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
usage daily --markdown
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### JSON output
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
usage daily --json
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Offline pricing (use cached LiteLLM pricing only)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
usage monthly --pricing-offline
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Override pricing URL
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
usage monthly --pricing-url https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Custom session directories
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
usage daily --pi-dir /path/to/pi/sessions --codex-dir /path/to/codex/sessions
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Output semantics
|
|
75
|
+
|
|
76
|
+
Each report includes:
|
|
77
|
+
|
|
78
|
+
- source rows (`pi`, `codex`) for each period
|
|
79
|
+
- a per-period combined subtotal row (only when multiple sources exist in that period)
|
|
80
|
+
- a final grand total row across all periods
|
|
81
|
+
|
|
82
|
+
Columns:
|
|
83
|
+
|
|
84
|
+
- Period
|
|
85
|
+
- Source
|
|
86
|
+
- Models
|
|
87
|
+
- Input
|
|
88
|
+
- Output
|
|
89
|
+
- Reasoning
|
|
90
|
+
- Cache Read
|
|
91
|
+
- Cache Write
|
|
92
|
+
- Total Tokens
|
|
93
|
+
- Cost (USD)
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
bun install
|
|
99
|
+
bun run lint
|
|
100
|
+
bun run typecheck
|
|
101
|
+
bun run test
|
|
102
|
+
bun run format:check
|
|
103
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|