tokenleak 1.0.0 → 1.0.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 CHANGED
@@ -134,24 +134,24 @@ tokenleak --format json --upload gist
134
134
 
135
135
  ## All flags
136
136
 
137
- | Flag | Alias | Default | Description |
138
- |------|-------|---------|-------------|
139
- | `--format` | `-f` | `terminal` | Output format: `json`, `svg`, `png`, `terminal` |
140
- | `--theme` | `-t` | `dark` | Colour theme: `dark`, `light` |
141
- | `--since` | `-s` | | Start date (`YYYY-MM-DD`). Overrides `--days` |
142
- | `--until` | `-u` | today | End date (`YYYY-MM-DD`) |
143
- | `--days` | `-d` | `90` | Number of days to look back |
144
- | `--output` | `-o` | stdout | Output file path. Format is inferred from extension |
145
- | `--width` | `-w` | `80` | Terminal width for dashboard layout |
146
- | `--no-color` | | `false` | Strip ANSI escape codes from terminal output |
147
- | `--no-insights` | | `false` | Hide the insights panel |
148
- | `--compare` | | | Compare two date ranges. Use `auto` or `YYYY-MM-DD..YYYY-MM-DD` |
149
- | `--provider` | `-p` | all | Filter to specific provider(s), comma-separated |
150
- | `--clipboard` | | `false` | Copy output to clipboard after rendering |
151
- | `--open` | | `false` | Open output file in default app (requires `--output`) |
152
- | `--upload` | | | Upload output to a service. Supported: `gist` |
153
- | `--version` | | | Print version number |
154
- | `--help` | | | Print usage information |
137
+ | Flag | Alias | Default | Description |
138
+ | --------------- | ----- | ---------- | --------------------------------------------------------------- |
139
+ | `--format` | `-f` | `terminal` | Output format: `json`, `svg`, `png`, `terminal` |
140
+ | `--theme` | `-t` | `dark` | Colour theme: `dark`, `light` |
141
+ | `--since` | `-s` | | Start date (`YYYY-MM-DD`). Overrides `--days` |
142
+ | `--until` | `-u` | today | End date (`YYYY-MM-DD`) |
143
+ | `--days` | `-d` | `90` | Number of days to look back |
144
+ | `--output` | `-o` | stdout | Output file path. Format is inferred from extension |
145
+ | `--width` | `-w` | `80` | Terminal width for dashboard layout |
146
+ | `--no-color` | | `false` | Strip ANSI escape codes from terminal output |
147
+ | `--no-insights` | | `false` | Hide the insights panel |
148
+ | `--compare` | | | Compare two date ranges. Use `auto` or `YYYY-MM-DD..YYYY-MM-DD` |
149
+ | `--provider` | `-p` | all | Filter to specific provider(s), comma-separated |
150
+ | `--clipboard` | | `false` | Copy output to clipboard after rendering |
151
+ | `--open` | | `false` | Open output file in default app (requires `--output`) |
152
+ | `--upload` | | | Upload output to a service. Supported: `gist` |
153
+ | `--version` | | | Print version number |
154
+ | `--help` | | | Print usage information |
155
155
 
156
156
  ## Supported providers
157
157
 
@@ -159,30 +159,30 @@ tokenleak --format json --upload gist
159
159
 
160
160
  Reads JSONL conversation logs from the Claude Code projects directory. Each assistant message with a `usage` field is parsed for input/output/cache token counts.
161
161
 
162
- | | |
163
- |---|---|
164
- | **Data location** | `~/.claude/projects/*/*.jsonl` |
165
- | **Override** | Set `CLAUDE_CONFIG_DIR` environment variable |
166
- | **Provider name** | `claude-code` |
162
+ | | |
163
+ | ----------------- | -------------------------------------------- |
164
+ | **Data location** | `~/.claude/projects/*/*.jsonl` |
165
+ | **Override** | Set `CLAUDE_CONFIG_DIR` environment variable |
166
+ | **Provider name** | `claude-code` |
167
167
 
168
168
  ### Codex
169
169
 
170
170
  Reads JSONL session logs from the Codex sessions directory. Parses `response` events for token usage with cumulative delta extraction.
171
171
 
172
- | | |
173
- |---|---|
174
- | **Data location** | `~/.codex/sessions/*.jsonl` |
175
- | **Override** | Set `CODEX_HOME` environment variable |
176
- | **Provider name** | `codex` |
172
+ | | |
173
+ | ----------------- | ------------------------------------- |
174
+ | **Data location** | `~/.codex/sessions/*.jsonl` |
175
+ | **Override** | Set `CODEX_HOME` environment variable |
176
+ | **Provider name** | `codex` |
177
177
 
178
178
  ### Open Code
179
179
 
180
180
  Reads usage data from the Open Code SQLite database. Falls back to legacy JSON session files if no database is found.
181
181
 
182
- | | |
183
- |---|---|
184
- | **Data location** | `~/.opencode/sessions.db` (primary) or `~/.opencode/sessions/*.json` (fallback) |
185
- | **Provider name** | `open-code` |
182
+ | | |
183
+ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
184
+ | **Data location** | `~/.local/share/opencode/storage/message/<session>/*.json` (primary), `~/.opencode/opencode.db` or `~/.opencode/sessions.db` (legacy), `~/.opencode/sessions/*.json` (legacy fallback) |
185
+ | **Provider name** | `open-code` |
186
186
 
187
187
  ## Output formats
188
188
 
@@ -219,24 +219,30 @@ Structured JSON output containing:
219
219
  "cacheReadTokens": 2000,
220
220
  "cacheWriteTokens": 500,
221
221
  "totalTokens": 22500,
222
- "cost": 0.0825
223
- }
222
+ "cost": 0.0825,
223
+ },
224
224
  // ...
225
225
  ],
226
226
  "models": [
227
- { "model": "claude-sonnet-4", "inputTokens": 10000, "outputTokens": 3000, "totalTokens": 13000, "cost": 0.075 }
227
+ {
228
+ "model": "claude-sonnet-4",
229
+ "inputTokens": 10000,
230
+ "outputTokens": 3000,
231
+ "totalTokens": 13000,
232
+ "cost": 0.075,
233
+ },
228
234
  ],
229
235
  "totalTokens": 22500,
230
- "totalCost": 0.0825
231
- }
236
+ "totalCost": 0.0825,
237
+ },
232
238
  ],
233
239
  "aggregated": {
234
240
  "currentStreak": 12,
235
241
  "longestStreak": 45,
236
242
  "totalTokens": 1500000,
237
- "totalCost": 52.50,
243
+ "totalCost": 52.5,
238
244
  // ... rolling windows, peaks, averages, day-of-week, top models
239
- }
245
+ },
240
246
  }
241
247
  ```
242
248
 
@@ -274,14 +280,14 @@ All fields are optional. Only include the ones you want to override.
274
280
 
275
281
  ## Environment variables
276
282
 
277
- | Variable | Default | Description |
278
- |----------|---------|-------------|
279
- | `TOKENLEAK_FORMAT` | `terminal` | Default output format |
280
- | `TOKENLEAK_THEME` | `dark` | Default colour theme |
281
- | `TOKENLEAK_DAYS` | `90` | Default lookback period in days |
283
+ | Variable | Default | Description |
284
+ | ---------------------------------- | ------------------ | ------------------------------------------------------- |
285
+ | `TOKENLEAK_FORMAT` | `terminal` | Default output format |
286
+ | `TOKENLEAK_THEME` | `dark` | Default colour theme |
287
+ | `TOKENLEAK_DAYS` | `90` | Default lookback period in days |
282
288
  | `TOKENLEAK_MAX_JSONL_RECORD_BYTES` | `10485760` (10 MB) | Max size of a single JSONL record before it is rejected |
283
- | `CLAUDE_CONFIG_DIR` | `~/.claude` | Claude Code configuration directory |
284
- | `CODEX_HOME` | `~/.codex` | Codex home directory |
289
+ | `CLAUDE_CONFIG_DIR` | `~/.claude` | Claude Code configuration directory |
290
+ | `CODEX_HOME` | `~/.codex` | Codex home directory |
285
291
 
286
292
  ## What Tokenleak tracks
287
293
 
@@ -309,13 +315,13 @@ It then computes:
309
315
 
310
316
  Tokenleak includes pricing for these model families:
311
317
 
312
- | Family | Models |
313
- |--------|--------|
314
- | Claude 3 | `claude-3-haiku`, `claude-3-sonnet`, `claude-3-opus` |
315
- | Claude 3.5 | `claude-3.5-haiku`, `claude-3.5-sonnet` |
316
- | Claude 4 | `claude-sonnet-4`, `claude-opus-4` |
317
- | GPT-4o | `gpt-4o`, `gpt-4o-mini` |
318
- | o-series | `o1`, `o1-mini`, `o3`, `o3-mini`, `o4-mini` |
318
+ | Family | Models |
319
+ | ---------- | ---------------------------------------------------- |
320
+ | Claude 3 | `claude-3-haiku`, `claude-3-sonnet`, `claude-3-opus` |
321
+ | Claude 3.5 | `claude-3.5-haiku`, `claude-3.5-sonnet` |
322
+ | Claude 4 | `claude-sonnet-4`, `claude-opus-4` |
323
+ | GPT-4o | `gpt-4o`, `gpt-4o-mini` |
324
+ | o-series | `o1`, `o1-mini`, `o3`, `o3-mini`, `o4-mini` |
319
325
 
320
326
  Model names with date suffixes (e.g. `claude-sonnet-4-20250514`) are automatically normalised. Unknown models show `$0.00` cost but tokens are still tracked.
321
327
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "tokenleak",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Visualise your AI coding-assistant token usage across providers — heatmaps, dashboards, and shareable cards.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "tokenleak": "./tokenleak.js"
7
+ "tokenleak": "tokenleak"
8
8
  },
9
9
  "files": [
10
- "tokenleak.js"
10
+ "tokenleak"
11
11
  ],
12
12
  "dependencies": {
13
13
  "sharp": "^0.34.0"
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "repository": {
30
30
  "type": "git",
31
- "url": "https://github.com/ya-nsh/tokenleak.git"
31
+ "url": "git+https://github.com/ya-nsh/tokenleak.git"
32
32
  },
33
33
  "license": "MIT",
34
34
  "author": "ya-nsh"