llm-usage-metrics 0.1.5 → 0.1.7
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 +86 -3
- package/dist/index.js +1687 -1124
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -104,12 +104,24 @@ llm-usage monthly --pricing-offline
|
|
|
104
104
|
llm-usage monthly --pricing-url https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
Pricing behavior notes:
|
|
108
|
+
|
|
109
|
+
- LiteLLM is the active pricing source.
|
|
110
|
+
- explicit `costUsd: 0` events are re-priced from LiteLLM when model pricing is available.
|
|
111
|
+
- when pricing cannot be loaded from LiteLLM (or cache in offline mode), report generation fails fast.
|
|
112
|
+
|
|
107
113
|
### Custom session directories
|
|
108
114
|
|
|
109
115
|
```bash
|
|
110
116
|
llm-usage daily --pi-dir /path/to/pi/sessions --codex-dir /path/to/codex/sessions
|
|
111
117
|
```
|
|
112
118
|
|
|
119
|
+
Or use generic source-id mapping (repeatable):
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
llm-usage daily --source-dir pi=/path/to/pi/sessions --source-dir codex=/path/to/codex/sessions
|
|
123
|
+
```
|
|
124
|
+
|
|
113
125
|
### Filter by source
|
|
114
126
|
|
|
115
127
|
Only codex rows:
|
|
@@ -131,7 +143,78 @@ llm-usage monthly --source pi --source codex
|
|
|
131
143
|
llm-usage monthly --source pi,codex
|
|
132
144
|
```
|
|
133
145
|
|
|
134
|
-
|
|
146
|
+
### Filter by provider (optional)
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
llm-usage monthly --provider openai
|
|
150
|
+
llm-usage monthly --provider github
|
|
151
|
+
llm-usage monthly --provider kimi
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Filter by model (optional)
|
|
155
|
+
|
|
156
|
+
`--model` supports repeatable/comma-separated filters. Matching is case-insensitive.
|
|
157
|
+
|
|
158
|
+
- if an exact model exists for a filter value, exact matching is used
|
|
159
|
+
- otherwise, substring matching is used
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# substring match (all Claude-family models)
|
|
163
|
+
llm-usage monthly --model claude
|
|
164
|
+
|
|
165
|
+
# exact match when present
|
|
166
|
+
llm-usage monthly --model claude-sonnet-4.5
|
|
167
|
+
|
|
168
|
+
# multiple filters
|
|
169
|
+
llm-usage monthly --model claude --model gpt-5
|
|
170
|
+
llm-usage monthly --model claude,gpt-5
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Per-model columns (opt-in detailed table layout)
|
|
174
|
+
|
|
175
|
+
Default output is compact (model names only in the Models column).
|
|
176
|
+
|
|
177
|
+
Use `--per-model-columns` to render per-model multiline metrics in each numeric column:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
llm-usage monthly --per-model-columns
|
|
181
|
+
llm-usage monthly --markdown --per-model-columns
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Output features
|
|
185
|
+
|
|
186
|
+
### Terminal UI
|
|
187
|
+
|
|
188
|
+
The CLI provides an enhanced terminal output with:
|
|
189
|
+
|
|
190
|
+
- **Boxed report header** showing the report type and timezone
|
|
191
|
+
- **Session summary** displayed at startup (session files and event counts per source)
|
|
192
|
+
- **Pricing source info** indicating whether data was loaded from cache or fetched remotely
|
|
193
|
+
- **Environment variable overrides** displayed when active
|
|
194
|
+
- **Models displayed as bullet points** for better readability
|
|
195
|
+
- **Rounded table borders** and improved color scheme
|
|
196
|
+
|
|
197
|
+
Example output:
|
|
198
|
+
|
|
199
|
+
```text
|
|
200
|
+
ℹ Found 12 session file(s) with 45 event(s)
|
|
201
|
+
• pi: 8 file(s), 32 events
|
|
202
|
+
• codex: 4 file(s), 13 events
|
|
203
|
+
ℹ Loaded pricing from cache
|
|
204
|
+
|
|
205
|
+
┌──────────────────────────────────────────────────────────┐
|
|
206
|
+
│ Monthly Token Usage Report (Timezone: Africa/Casablanca) │
|
|
207
|
+
└──────────────────────────────────────────────────────────┘
|
|
208
|
+
|
|
209
|
+
╭────────────┬──────────┬──────────────────────╮
|
|
210
|
+
│ Period │ Source │ Models │
|
|
211
|
+
├────────────┼──────────┼──────────────────────┤
|
|
212
|
+
│ Feb 2026 │ pi │ • gpt-5.2 │
|
|
213
|
+
│ │ │ • gpt-5.2-codex │
|
|
214
|
+
╰────────────┴──────────┴──────────────────────╯
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Report structure
|
|
135
218
|
|
|
136
219
|
Each report includes:
|
|
137
220
|
|
|
@@ -149,8 +232,8 @@ Columns:
|
|
|
149
232
|
- Reasoning
|
|
150
233
|
- Cache Read
|
|
151
234
|
- Cache Write
|
|
152
|
-
- Total
|
|
153
|
-
- Cost
|
|
235
|
+
- Total
|
|
236
|
+
- Cost
|
|
154
237
|
|
|
155
238
|
## Development
|
|
156
239
|
|