@aiusage/cli 1.7.9 → 1.7.14

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
@@ -18,7 +18,7 @@ differ, rather than treating every local record as billable token usage.
18
18
 
19
19
  | Tool | Sources and compatibility behavior |
20
20
  |------|------------------------------------|
21
- | Claude Code | `~/.config/claude/projects/` and `~/.claude/projects/` JSONL; deduplicates parent/sidechain replays, merges streaming snapshots per token field, and honors wrapper providers. Aggregate `stats-cache.json` is intentionally not converted into guessed per-message usage. |
21
+ | Claude Code | JSONL from `~/.config/claude/projects/`, `~/.claude/projects/`, `CLAUDE_CONFIG_DIR`, `~/.claude-*` profiles, and Claude Desktop Cowork session roots; deduplicates parent/sidechain replays, merges streaming snapshots per token field, and honors wrapper providers. Aggregate `stats-cache.json` is intentionally not converted into guessed per-message usage. |
22
22
  | Codex CLI | Active and archived `~/.codex` sessions; fork-aware replay boundaries, inherited baselines, `last_token_usage`, and total-delta fallback. |
23
23
  | Cursor | Reads the local `state.vscdb` credential and requests Cursor's token-strategy usage CSV; the database is snapshotted when locked. |
24
24
  | Copilot CLI | OpenTelemetry JSONL under `~/.copilot/otel/` plus `session-state` shutdown totals; granular inference spans supersede same-trace aggregates. |
@@ -92,7 +92,7 @@ aiusage report --no-emoji # disable emoji in title
92
92
  aiusage report --json # JSON output
93
93
  ```
94
94
 
95
- Reads data from local tool data directories including `~/.claude/projects` (Claude Code), `~/.codex` (Codex), Cursor local state plus usage export, VS Code Copilot Chat logs, and `~/.gemini/antigravity` (Antigravity).
95
+ Reads data from local tool data directories including Claude Code and Desktop Cowork session roots, `~/.codex` (Codex), Cursor local state plus usage export, VS Code Copilot Chat logs, and `~/.gemini/antigravity` (Antigravity).
96
96
 
97
97
  **Compact mode** (default) shows Sources and Daily tables with merged Cache column and 2-decimal cost. **Detail mode** (`--detail`) expands all columns (CacheRead, CacheWrite, Reasoning), adds Top Models and Pricing Notes sections, and shows 4-decimal cost.
98
98
 
package/dist/cli.js CHANGED
@@ -180,26 +180,47 @@ function upsertSessionDate(sessionDates, sessionId, timestamp) {
180
180
 
181
181
  // src/scanners/claude.ts
182
182
  import { createReadStream } from "node:fs";
183
- import { readdir as readdir3 } from "node:fs/promises";
183
+ import { readdir as readdir3, realpath } from "node:fs/promises";
184
184
  import { join as join3 } from "node:path";
185
185
  import { homedir as homedir2 } from "node:os";
186
186
  import { createInterface } from "node:readline";
187
- var FILE_CONCURRENCY = 16, MAX_LINE_BYTES = 64 * 1024 * 1024;
188
- function getClaudeProjectDirs(claudeDir) {
187
+ var FILE_CONCURRENCY = 16, MAX_LINE_BYTES = 64 * 1024 * 1024, MAX_COWORK_DISCOVERY_DEPTH = 8, COWORK_IGNORED_DIRS = /* @__PURE__ */ new Set(["rpm", "skills"]);
188
+ async function discoverClaudeProjectDirs(claudeDir, options = {}) {
189
189
  if (claudeDir) return [claudeDir];
190
- let envVar = process.env.CLAUDE_CONFIG_DIR?.trim();
191
- if (envVar)
192
- return envVar.split(",").map((p) => p.trim()).filter(Boolean).map((p) => join3(p, "projects"));
193
- let home = homedir2();
194
- return [
190
+ let home = options.homeDir ?? homedir2(), platform2 = options.platform ?? process.platform, env = options.env ?? process.env, candidates = [
195
191
  join3(home, ".config", "claude", "projects"),
196
192
  join3(home, ".claude", "projects")
197
- ];
193
+ ], configured = env.CLAUDE_CONFIG_DIR?.trim();
194
+ if (configured)
195
+ for (let root of configured.split(",").map((p) => p.trim()).filter(Boolean))
196
+ candidates.push(join3(root, "projects"));
197
+ try {
198
+ let entries = await readdir3(home, { withFileTypes: !0 });
199
+ for (let entry of entries)
200
+ /^\.claude-.+/.test(entry.name) && (!entry.isDirectory() && !entry.isSymbolicLink() || candidates.push(join3(home, entry.name, "projects")));
201
+ } catch {
202
+ }
203
+ let desktopDataDir = platform2 === "darwin" ? join3(home, "Library", "Application Support", "Claude") : platform2 === "win32" ? join3(env.APPDATA?.trim() || join3(home, "AppData", "Roaming"), "Claude") : join3(env.XDG_CONFIG_HOME?.trim() || join3(home, ".config"), "Claude");
204
+ await discoverCoworkProjectDirs(
205
+ join3(desktopDataDir, "local-agent-mode-sessions"),
206
+ 0,
207
+ candidates
208
+ );
209
+ let seen = /* @__PURE__ */ new Set(), unique = [];
210
+ for (let candidate of candidates) {
211
+ let canonical = candidate;
212
+ try {
213
+ canonical = await realpath(candidate);
214
+ } catch {
215
+ }
216
+ seen.has(canonical) || (seen.add(canonical), unique.push(candidate));
217
+ }
218
+ return unique;
198
219
  }
199
220
  async function scanClaudeDates(targetDates, claudeDir, projectAliases) {
200
221
  let targetDateSet = new Set(targetDates), groupedByDate = /* @__PURE__ */ new Map();
201
222
  for (let targetDate of targetDateSet) groupedByDate.set(targetDate, /* @__PURE__ */ new Map());
202
- let baseDirs = getClaudeProjectDirs(claudeDir), processedHashes = /* @__PURE__ */ new Map(), sessionSets = /* @__PURE__ */ new Map(), fileJobs = [];
223
+ let baseDirs = await discoverClaudeProjectDirs(claudeDir), processedHashes = /* @__PURE__ */ new Map(), sessionSets = /* @__PURE__ */ new Map(), fileJobs = [];
203
224
  for (let baseDir of baseDirs) {
204
225
  let projectDirs;
205
226
  try {
@@ -351,6 +372,21 @@ async function walkForJsonl(dir, result) {
351
372
  entry.isDirectory() ? await walkForJsonl(fullPath, result) : entry.name.endsWith(".jsonl") && result.push(fullPath);
352
373
  }
353
374
  }
375
+ async function discoverCoworkProjectDirs(dir, depth, result) {
376
+ let entries;
377
+ try {
378
+ entries = await readdir3(dir, { withFileTypes: !0 });
379
+ } catch {
380
+ return;
381
+ }
382
+ if (entries.find((entry) => entry.name === ".claude" && entry.isDirectory())) {
383
+ result.push(join3(dir, ".claude", "projects"));
384
+ return;
385
+ }
386
+ if (!(depth >= MAX_COWORK_DISCOVERY_DEPTH))
387
+ for (let entry of entries)
388
+ !entry.isDirectory() || COWORK_IGNORED_DIRS.has(entry.name) || await discoverCoworkProjectDirs(join3(dir, entry.name), depth + 1, result);
389
+ }
354
390
 
355
391
  // src/scanners/codex.ts
356
392
  import { createReadStream as createReadStream2 } from "node:fs";
@@ -363,6 +399,49 @@ import { createInterface as createInterface2 } from "node:readline";
363
399
  var anthropic = {
364
400
  "claude-code": {
365
401
  models: {
402
+ "claude-fable-5-1": {
403
+ currency: "USD",
404
+ effective_from: "2026-09-01",
405
+ input_per_million: 10,
406
+ output_per_million: 50,
407
+ cache_write_5m_per_million: 12.5,
408
+ cache_write_1h_per_million: 20,
409
+ cached_input_per_million: 0.25
410
+ },
411
+ "claude-fable-5": {
412
+ currency: "USD",
413
+ input_per_million: 10,
414
+ output_per_million: 50,
415
+ cache_write_5m_per_million: 12.5,
416
+ cache_write_1h_per_million: 20,
417
+ cached_input_per_million: 1
418
+ },
419
+ "claude-mythos-5": {
420
+ currency: "USD",
421
+ notes: "limited availability",
422
+ input_per_million: 10,
423
+ output_per_million: 50,
424
+ cache_write_5m_per_million: 12.5,
425
+ cache_write_1h_per_million: 20,
426
+ cached_input_per_million: 1
427
+ },
428
+ "claude-opus-5-5": {
429
+ currency: "USD",
430
+ effective_from: "2026-09-22",
431
+ input_per_million: 4,
432
+ output_per_million: 20,
433
+ cache_write_5m_per_million: 5,
434
+ cache_write_1h_per_million: 8,
435
+ cached_input_per_million: 0.2
436
+ },
437
+ "claude-opus-5": {
438
+ currency: "USD",
439
+ input_per_million: 5,
440
+ output_per_million: 25,
441
+ cache_write_5m_per_million: 6.25,
442
+ cache_write_1h_per_million: 10,
443
+ cached_input_per_million: 0.5
444
+ },
366
445
  "claude-opus-4-8": {
367
446
  currency: "USD",
368
447
  input_per_million: 5,
@@ -412,6 +491,16 @@ var anthropic = {
412
491
  cache_write_1h_per_million: 30,
413
492
  cached_input_per_million: 1.5
414
493
  },
494
+ "claude-sonnet-5": {
495
+ currency: "USD",
496
+ effective_to: "2026-08-31",
497
+ notes: "introductory pricing through 2026-08-31; standard pricing is $3 input / $15 output from 2026-09-01",
498
+ input_per_million: 2,
499
+ output_per_million: 10,
500
+ cache_write_5m_per_million: 2.5,
501
+ cache_write_1h_per_million: 4,
502
+ cached_input_per_million: 0.2
503
+ },
415
504
  "claude-sonnet-4-6": {
416
505
  currency: "USD",
417
506
  input_per_million: 3,
@@ -462,73 +551,143 @@ var anthropic = {
462
551
  var openai = {
463
552
  codex: {
464
553
  models: {
465
- // ── GPT-5.6 系列 ──
466
- "gpt-5.6-sol": {
554
+ // ── GPT-6 系列 ──
555
+ "gpt-6-astra": {
467
556
  currency: "USD",
468
557
  notes: "prompts over 272K input tokens bill the full request at long-context rates",
469
- input_per_million: 5,
470
- cached_input_per_million: 0.5,
471
- cache_write_per_million: 6.25,
472
- output_per_million: 30,
558
+ input_per_million: 10,
559
+ cached_input_per_million: 1,
560
+ cache_write_per_million: 12.5,
561
+ output_per_million: 50,
473
562
  tiers: [
474
563
  {
475
564
  threshold: 272e3,
476
- input_per_million: 5,
477
- cached_input_per_million: 0.5,
478
- cache_write_per_million: 6.25,
479
- output_per_million: 30
480
- },
481
- {
482
565
  input_per_million: 10,
483
566
  cached_input_per_million: 1,
484
567
  cache_write_per_million: 12.5,
485
- output_per_million: 45
568
+ output_per_million: 50
569
+ },
570
+ {
571
+ input_per_million: 20,
572
+ cached_input_per_million: 2,
573
+ cache_write_per_million: 25,
574
+ output_per_million: 75
486
575
  }
487
576
  ]
488
577
  },
489
- "gpt-5.6-terra": {
578
+ "gpt-6-sol": {
490
579
  currency: "USD",
491
580
  notes: "prompts over 272K input tokens bill the full request at long-context rates",
492
- input_per_million: 2.5,
493
- cached_input_per_million: 0.25,
494
- cache_write_per_million: 3.125,
495
- output_per_million: 15,
581
+ input_per_million: 2,
582
+ cached_input_per_million: 0.2,
583
+ cache_write_per_million: 2.5,
584
+ output_per_million: 10,
496
585
  tiers: [
497
586
  {
498
587
  threshold: 272e3,
499
- input_per_million: 2.5,
500
- cached_input_per_million: 0.25,
501
- cache_write_per_million: 3.125,
502
- output_per_million: 15
588
+ input_per_million: 2,
589
+ cached_input_per_million: 0.2,
590
+ cache_write_per_million: 2.5,
591
+ output_per_million: 10
503
592
  },
504
593
  {
505
- input_per_million: 5,
506
- cached_input_per_million: 0.5,
507
- cache_write_per_million: 6.25,
508
- output_per_million: 22.5
594
+ input_per_million: 4,
595
+ cached_input_per_million: 0.4,
596
+ cache_write_per_million: 5,
597
+ output_per_million: 15
509
598
  }
510
599
  ]
511
600
  },
512
- "gpt-5.6-luna": {
601
+ "gpt-6-luna": {
513
602
  currency: "USD",
514
603
  notes: "prompts over 272K input tokens bill the full request at long-context rates",
515
- input_per_million: 1,
516
- cached_input_per_million: 0.1,
517
- cache_write_per_million: 1.25,
518
- output_per_million: 6,
604
+ input_per_million: 0.1,
605
+ cached_input_per_million: 0.01,
606
+ cache_write_per_million: 0.125,
607
+ output_per_million: 0.5,
608
+ tiers: [
609
+ {
610
+ threshold: 272e3,
611
+ input_per_million: 0.1,
612
+ cached_input_per_million: 0.01,
613
+ cache_write_per_million: 0.125,
614
+ output_per_million: 0.5
615
+ },
616
+ {
617
+ input_per_million: 0.2,
618
+ cached_input_per_million: 0.02,
619
+ cache_write_per_million: 0.25,
620
+ output_per_million: 0.75
621
+ }
622
+ ]
623
+ },
624
+ // ── GPT-5.6 系列 ──
625
+ "gpt-5.6-sol": {
626
+ currency: "USD",
627
+ notes: "promotional pricing available at least through 2026-11-21; prompts over 272K input tokens bill the full request at long-context rates",
628
+ input_per_million: 4,
629
+ cached_input_per_million: 0.4,
630
+ cache_write_per_million: 5,
631
+ output_per_million: 20,
519
632
  tiers: [
520
633
  {
521
634
  threshold: 272e3,
522
- input_per_million: 1,
523
- cached_input_per_million: 0.1,
524
- cache_write_per_million: 1.25,
525
- output_per_million: 6
635
+ input_per_million: 4,
636
+ cached_input_per_million: 0.4,
637
+ cache_write_per_million: 5,
638
+ output_per_million: 20
526
639
  },
527
640
  {
641
+ input_per_million: 8,
642
+ cached_input_per_million: 0.8,
643
+ cache_write_per_million: 10,
644
+ output_per_million: 30
645
+ }
646
+ ]
647
+ },
648
+ "gpt-5.6-terra": {
649
+ currency: "USD",
650
+ notes: "prompts over 272K input tokens bill the full request at long-context rates",
651
+ input_per_million: 2,
652
+ cached_input_per_million: 0.2,
653
+ cache_write_per_million: 2.5,
654
+ output_per_million: 12,
655
+ tiers: [
656
+ {
657
+ threshold: 272e3,
528
658
  input_per_million: 2,
529
659
  cached_input_per_million: 0.2,
530
660
  cache_write_per_million: 2.5,
531
- output_per_million: 9
661
+ output_per_million: 12
662
+ },
663
+ {
664
+ input_per_million: 4,
665
+ cached_input_per_million: 0.4,
666
+ cache_write_per_million: 5,
667
+ output_per_million: 18
668
+ }
669
+ ]
670
+ },
671
+ "gpt-5.6-luna": {
672
+ currency: "USD",
673
+ notes: "prompts over 272K input tokens bill the full request at long-context rates",
674
+ input_per_million: 0.2,
675
+ cached_input_per_million: 0.02,
676
+ cache_write_per_million: 0.25,
677
+ output_per_million: 1.2,
678
+ tiers: [
679
+ {
680
+ threshold: 272e3,
681
+ input_per_million: 0.2,
682
+ cached_input_per_million: 0.02,
683
+ cache_write_per_million: 0.25,
684
+ output_per_million: 1.2
685
+ },
686
+ {
687
+ input_per_million: 0.4,
688
+ cached_input_per_million: 0.04,
689
+ cache_write_per_million: 0.5,
690
+ output_per_million: 1.8
532
691
  }
533
692
  ]
534
693
  },
@@ -1279,6 +1438,16 @@ var github = {
1279
1438
  models: {
1280
1439
  "gpt-4o": { currency: "USD", input_per_million: 2.5, cached_input_per_million: 1.25, output_per_million: 10 },
1281
1440
  "gpt-4o-mini": { currency: "USD", input_per_million: 0.15, cached_input_per_million: 0.075, output_per_million: 0.6 },
1441
+ "claude-fable-5": { currency: "USD", input_per_million: 10, cached_input_per_million: 1, output_per_million: 50 },
1442
+ "claude-mythos-5": { currency: "USD", input_per_million: 10, cached_input_per_million: 1, output_per_million: 50 },
1443
+ "claude-opus-5": { currency: "USD", input_per_million: 5, cached_input_per_million: 0.5, output_per_million: 25 },
1444
+ "claude-sonnet-5": {
1445
+ currency: "USD",
1446
+ notes: "introductory pricing through 2026-08-31; standard pricing is $3 input / $15 output from 2026-09-01",
1447
+ input_per_million: 2,
1448
+ cached_input_per_million: 0.2,
1449
+ output_per_million: 10
1450
+ },
1282
1451
  "claude-sonnet-4": { currency: "USD", input_per_million: 3, cached_input_per_million: 0.3, output_per_million: 15 },
1283
1452
  "claude-sonnet-4-6": { currency: "USD", input_per_million: 3, cached_input_per_million: 0.3, output_per_million: 15 },
1284
1453
  "o3-mini": { currency: "USD", input_per_million: 1.1, cached_input_per_million: 0.55, output_per_million: 4.4 },
@@ -1291,6 +1460,13 @@ var github = {
1291
1460
  var sourcegraph = {
1292
1461
  amp: {
1293
1462
  models: {
1463
+ "claude-sonnet-5": {
1464
+ currency: "USD",
1465
+ notes: "introductory pricing through 2026-08-31; standard pricing is $3 input / $15 output from 2026-09-01",
1466
+ input_per_million: 2,
1467
+ cached_input_per_million: 0.2,
1468
+ output_per_million: 10
1469
+ },
1294
1470
  "claude-sonnet-4": { currency: "USD", input_per_million: 3, cached_input_per_million: 0.3, output_per_million: 15 },
1295
1471
  "claude-sonnet-3.7": { currency: "USD", input_per_million: 3, cached_input_per_million: 0.3, output_per_million: 15 },
1296
1472
  "gemini-2.5-pro": { currency: "USD", input_per_million: 1.25, cached_input_per_million: 0.125, output_per_million: 10 }
@@ -1298,6 +1474,36 @@ var sourcegraph = {
1298
1474
  }
1299
1475
  };
1300
1476
 
1477
+ // ../shared/src/pricing/data/xai.ts
1478
+ var models = {
1479
+ "grok-4.7": {
1480
+ currency: "USD",
1481
+ notes: "prompts of 200K+ input tokens bill the full request at long-context rates; -fast is 2x",
1482
+ input_per_million: 2,
1483
+ cached_input_per_million: 0.5,
1484
+ cache_write_per_million: 2,
1485
+ output_per_million: 6,
1486
+ tiers: [
1487
+ {
1488
+ threshold: 199999,
1489
+ input_per_million: 2,
1490
+ cached_input_per_million: 0.5,
1491
+ cache_write_per_million: 2,
1492
+ output_per_million: 6
1493
+ },
1494
+ {
1495
+ input_per_million: 4,
1496
+ cached_input_per_million: 1,
1497
+ cache_write_per_million: 4,
1498
+ output_per_million: 12
1499
+ }
1500
+ ]
1501
+ }
1502
+ }, xai = {
1503
+ opencode: { models },
1504
+ "copilot-cli": { models }
1505
+ };
1506
+
1301
1507
  // ../shared/src/pricing/data/placeholders.ts
1302
1508
  var inflection = {
1303
1509
  pi: { models: {} }
@@ -1310,7 +1516,11 @@ var inflection = {
1310
1516
  };
1311
1517
 
1312
1518
  // ../shared/src/pricing/catalog.ts
1313
- var PRICING_VERSION = "2026-07-20-gpt-5.6-kimi-k3-v1", aliases = {
1519
+ var PRICING_VERSION = "2026-09-24-gpt-6-opus-5-5-grok-4-7-v1", aliases = {
1520
+ "claude-fibre-5": "claude-fable-5",
1521
+ "claude-fiber-5": "claude-fable-5",
1522
+ "claude-ops-5": "claude-opus-5",
1523
+ "claude-opus-5.5": "claude-opus-5-5",
1314
1524
  "claude-opus-4-7-20260201": "claude-opus-4-7",
1315
1525
  "claude-sonnet-4-6-20250301": "claude-sonnet-4-6",
1316
1526
  "claude-opus-4-6-20250301": "claude-opus-4-6",
@@ -1337,6 +1547,7 @@ var PRICING_VERSION = "2026-07-20-gpt-5.6-kimi-k3-v1", aliases = {
1337
1547
  zhipu,
1338
1548
  github,
1339
1549
  sourcegraph,
1550
+ xai,
1340
1551
  inflection,
1341
1552
  cursor,
1342
1553
  droid,
@@ -1345,11 +1556,16 @@ var PRICING_VERSION = "2026-07-20-gpt-5.6-kimi-k3-v1", aliases = {
1345
1556
  };
1346
1557
 
1347
1558
  // ../shared/src/pricing/calculate.ts
1348
- var ANTHROPIC_FAST_MULTIPLIER = 6, FAST_SUPPORTED = /* @__PURE__ */ new Set([
1349
- "claude-opus-4-8",
1350
- "claude-opus-4-7",
1351
- "claude-opus-4-6"
1352
- ]), OPENAI_CODEX_TIER_MULTIPLIERS = {
1559
+ var FAST_MULTIPLIERS = {
1560
+ "claude-opus-5-5": 2,
1561
+ "claude-opus-5": 2,
1562
+ "claude-opus-4-8": 2,
1563
+ "claude-opus-4-7": 6,
1564
+ "grok-4.7": 2
1565
+ }, OPENAI_CODEX_TIER_MULTIPLIERS = {
1566
+ "gpt-6-astra": 2,
1567
+ "gpt-6-sol": 2,
1568
+ "gpt-6-luna": 2,
1353
1569
  "gpt-5.6-sol": 2,
1354
1570
  "gpt-5.6-terra": 2,
1355
1571
  "gpt-5.6-luna": 2,
@@ -1360,21 +1576,21 @@ function splitServiceTierSuffix(model) {
1360
1576
  return model.endsWith("-priority") ? { baseModel: model.replace(/-priority$/, ""), tier: "priority" } : model.endsWith("-fast") ? { baseModel: model.replace(/-fast$/, ""), tier: "fast" } : { baseModel: model, tier: null };
1361
1577
  }
1362
1578
  function getServiceTierMultiplier(provider, product, resolvedModel, tier) {
1363
- return tier ? provider === "openai" && product === "codex" ? tier === "fast" && resolvedModel.startsWith("gpt-5.6-") ? 1 : OPENAI_CODEX_TIER_MULTIPLIERS[resolvedModel] ?? 1 : tier === "fast" && FAST_SUPPORTED.has(resolvedModel) ? ANTHROPIC_FAST_MULTIPLIER : 1 : 1;
1579
+ return tier ? provider === "openai" && product === "codex" ? tier === "fast" && resolvedModel.startsWith("gpt-5.6-") ? 1 : OPENAI_CODEX_TIER_MULTIPLIERS[resolvedModel] ?? 1 : tier === "fast" ? FAST_MULTIPLIERS[resolvedModel] ?? 1 : 1 : 1;
1364
1580
  }
1365
1581
  function resolveModelPricing(catalog2, provider, product, model) {
1366
- let models = catalog2.providers[provider]?.[product]?.models;
1367
- if (!models) return null;
1582
+ let models2 = catalog2.providers[provider]?.[product]?.models;
1583
+ if (!models2) return null;
1368
1584
  let aliasResolved = catalog2.aliases[model];
1369
- if (aliasResolved && models[aliasResolved])
1370
- return { resolvedModel: aliasResolved, pricing: models[aliasResolved], normalized: !1 };
1371
- if (models[model])
1372
- return { resolvedModel: model, pricing: models[model], normalized: !1 };
1373
- for (let knownModel of Object.keys(models).sort((a, b) => b.length - a.length)) {
1585
+ if (aliasResolved && models2[aliasResolved])
1586
+ return { resolvedModel: aliasResolved, pricing: models2[aliasResolved], normalized: !1 };
1587
+ if (models2[model])
1588
+ return { resolvedModel: model, pricing: models2[model], normalized: !1 };
1589
+ for (let knownModel of Object.keys(models2).sort((a, b) => b.length - a.length)) {
1374
1590
  if (!model.startsWith(`${knownModel}-`)) continue;
1375
1591
  let suffix = model.slice(knownModel.length + 1);
1376
1592
  if (!/^\d+(?:[-.]\d+)*(?:-\d{6,8})?$/.test(suffix))
1377
- return { resolvedModel: knownModel, pricing: models[knownModel], normalized: !0 };
1593
+ return { resolvedModel: knownModel, pricing: models2[knownModel], normalized: !0 };
1378
1594
  }
1379
1595
  return null;
1380
1596
  }
@@ -1505,14 +1721,16 @@ async function processCodexFile(filePath, projectAliases, serviceTier) {
1505
1721
  state.previousTotals = parsed.nextTotals;
1506
1722
  continue;
1507
1723
  }
1508
- let { tokens, nextTotals } = parsed, cachedInput = Math.min(tokens.cached, tokens.input), nonCachedInput = Math.max(tokens.input - cachedInput, 0), output = tokens.output, reasoning = tokens.reasoning;
1509
- if (nonCachedInput + cachedInput + output + reasoning === 0) continue;
1724
+ let { tokens, nextTotals } = parsed, cachedInput = Math.min(tokens.cached, tokens.input), cacheWriteInput = Math.min(tokens.cacheWrite, Math.max(tokens.input - cachedInput, 0)), nonCachedInput = Math.max(tokens.input - cachedInput - cacheWriteInput, 0), reasoning = Math.min(tokens.reasoning, tokens.output), output = Math.max(tokens.output - reasoning, 0);
1725
+ if (nonCachedInput + cachedInput + cacheWriteInput + output + reasoning === 0) continue;
1510
1726
  state.previousTotals = nextTotals;
1511
- let dedupScope = state.sessionForkedFromId ?? state.sessionIdFromMeta ?? fileSessionId, signature = total ? `codex|${dedupScope}|${state.currentModel}|${total.input}|${total.cached}|${total.output}|${total.reasoning}` : `codex|${dedupScope}|${state.currentModel}|${ts.getTime()}|${tokens.input}|${tokens.cached}|${tokens.output}|${tokens.reasoning}`, eventCost = calculateCost("openai", "codex", state.currentModel, {
1727
+ let dedupScope = state.sessionForkedFromId ?? state.sessionIdFromMeta ?? fileSessionId, signature = total ? `codex|${dedupScope}|${state.currentModel}|${total.input}|${total.cached}|${total.cacheWrite}|${total.output}|${total.reasoning}` : `codex|${dedupScope}|${state.currentModel}|${ts.getTime()}|${tokens.input}|${tokens.cached}|${tokens.cacheWrite}|${tokens.output}|${tokens.reasoning}`, eventCost = calculateCost("openai", "codex", state.currentModel, {
1512
1728
  inputTokens: nonCachedInput,
1513
1729
  cachedInputTokens: cachedInput,
1514
- cacheWriteTokens: 0,
1515
- outputTokens: output
1730
+ cacheWriteTokens: cacheWriteInput,
1731
+ // Reasoning is billed at the output rate, so pricing still uses the
1732
+ // inclusive raw Codex output total.
1733
+ outputTokens: tokens.output
1516
1734
  }), exactEventCost = eventCost.costStatus === "exact" ? eventCost.estimatedCostUsd : void 0;
1517
1735
  events.push({
1518
1736
  usageDate,
@@ -1521,6 +1739,7 @@ async function processCodexFile(filePath, projectAliases, serviceTier) {
1521
1739
  projectFields: { ...state.projectFields },
1522
1740
  inputTokens: nonCachedInput,
1523
1741
  cachedInputTokens: cachedInput,
1742
+ cacheWriteTokens: cacheWriteInput,
1524
1743
  outputTokens: output,
1525
1744
  reasoningOutputTokens: reasoning,
1526
1745
  costUSD: exactEventCost,
@@ -1538,7 +1757,7 @@ function mergeCodexEvent(groupedByDate, event) {
1538
1757
  if (!grouped) return;
1539
1758
  let key = `${event.model}|${event.projectFields.project}`, existing = grouped.get(key);
1540
1759
  if (existing) {
1541
- existing.eventCount += 1, existing.inputTokens += event.inputTokens, existing.cachedInputTokens += event.cachedInputTokens, existing.outputTokens += event.outputTokens, existing.reasoningOutputTokens += event.reasoningOutputTokens, event.costUSD !== void 0 && (existing.costUSD = (existing.costUSD ?? 0) + event.costUSD, existing.pricingVersion = event.pricingVersion);
1760
+ existing.eventCount += 1, existing.inputTokens += event.inputTokens, existing.cachedInputTokens += event.cachedInputTokens, existing.cacheWriteTokens += event.cacheWriteTokens, existing.outputTokens += event.outputTokens, existing.reasoningOutputTokens += event.reasoningOutputTokens, event.costUSD !== void 0 && (existing.costUSD = (existing.costUSD ?? 0) + event.costUSD, existing.pricingVersion = event.pricingVersion);
1542
1761
  return;
1543
1762
  }
1544
1763
  let breakdown = {
@@ -1552,7 +1771,7 @@ function mergeCodexEvent(groupedByDate, event) {
1552
1771
  eventCount: 1,
1553
1772
  inputTokens: event.inputTokens,
1554
1773
  cachedInputTokens: event.cachedInputTokens,
1555
- cacheWriteTokens: 0,
1774
+ cacheWriteTokens: event.cacheWriteTokens,
1556
1775
  outputTokens: event.outputTokens,
1557
1776
  reasoningOutputTokens: event.reasoningOutputTokens
1558
1777
  };
@@ -1580,18 +1799,20 @@ function totalsFromUsage(usage) {
1580
1799
  clampToken2(usage.cached_input_tokens),
1581
1800
  clampToken2(usage.cache_read_input_tokens)
1582
1801
  ),
1802
+ cacheWrite: clampToken2(usage.cache_write_input_tokens),
1583
1803
  output: clampToken2(usage.output_tokens),
1584
1804
  reasoning: clampToken2(usage.reasoning_output_tokens)
1585
1805
  };
1586
1806
  }
1587
1807
  function totalsEqual(a, b) {
1588
- return a.input === b.input && a.cached === b.cached && a.output === b.output && a.reasoning === b.reasoning;
1808
+ return a.input === b.input && a.cached === b.cached && a.cacheWrite === b.cacheWrite && a.output === b.output && a.reasoning === b.reasoning;
1589
1809
  }
1590
1810
  function totalsDelta(current, previous) {
1591
- if (!(current.input < previous.input || current.cached < previous.cached || current.output < previous.output || current.reasoning < previous.reasoning))
1811
+ if (!(current.input < previous.input || current.cached < previous.cached || current.cacheWrite < previous.cacheWrite || current.output < previous.output || current.reasoning < previous.reasoning))
1592
1812
  return {
1593
1813
  input: current.input - previous.input,
1594
1814
  cached: current.cached - previous.cached,
1815
+ cacheWrite: current.cacheWrite - previous.cacheWrite,
1595
1816
  output: current.output - previous.output,
1596
1817
  reasoning: current.reasoning - previous.reasoning
1597
1818
  };
@@ -1600,12 +1821,13 @@ function totalsAdd(a, b) {
1600
1821
  return {
1601
1822
  input: a.input + b.input,
1602
1823
  cached: a.cached + b.cached,
1824
+ cacheWrite: a.cacheWrite + b.cacheWrite,
1603
1825
  output: a.output + b.output,
1604
1826
  reasoning: a.reasoning + b.reasoning
1605
1827
  };
1606
1828
  }
1607
1829
  function totalsSum(value) {
1608
- return value.input + value.cached + value.output + value.reasoning;
1830
+ return value.input + value.cached + value.cacheWrite + value.output + value.reasoning;
1609
1831
  }
1610
1832
  function looksLikeStaleRegression(current, previous, last) {
1611
1833
  let previousSum = totalsSum(previous), currentSum = totalsSum(current), lastSum = totalsSum(last);
@@ -1634,7 +1856,7 @@ function shouldSkipInheritedSnapshot(state, usage, totals) {
1634
1856
  let reported = usage ? reportedTotalTokens(usage) : void 0;
1635
1857
  if (reported != null && state.inheritedReportedTotal != null && reported <= state.inheritedReportedTotal) return !0;
1636
1858
  let baseline = state.inheritedBaseline;
1637
- return !!(totals && baseline && totals.input <= baseline.input && totals.cached <= baseline.cached && totals.output <= baseline.output && totals.reasoning <= baseline.reasoning);
1859
+ return !!(totals && baseline && totals.input <= baseline.input && totals.cached <= baseline.cached && totals.cacheWrite <= baseline.cacheWrite && totals.output <= baseline.output && totals.reasoning <= baseline.reasoning);
1638
1860
  }
1639
1861
  function reportedTotalTokens(usage) {
1640
1862
  return typeof usage.total_tokens == "number" && usage.total_tokens >= 0 ? usage.total_tokens : void 0;
@@ -1683,7 +1905,7 @@ async function detectCodexServiceTier(baseDir) {
1683
1905
  }
1684
1906
  function applyCodexServiceTier(model, serviceTier) {
1685
1907
  if (!serviceTier || model.endsWith("-fast") || model.endsWith("-priority")) return model;
1686
- let supportsFast = model === "gpt-5.5" || model === "gpt-5.4";
1908
+ let supportsFast = model === "gpt-6-astra" || model === "gpt-6-sol" || model === "gpt-6-luna" || model === "gpt-5.5" || model === "gpt-5.4";
1687
1909
  return serviceTier === "fast" && supportsFast || serviceTier === "priority" && (model === "gpt-5.6" || model === "gpt-5.6-sol" || model === "gpt-5.6-terra" || model === "gpt-5.6-luna" || supportsFast) ? `${model}-${serviceTier}` : model;
1688
1910
  }
1689
1911
  async function walkDir(dir, result) {
@@ -2436,8 +2658,8 @@ function parseDirectGeminiEvent(value, modelHint, sessionId, fallbackTs) {
2436
2658
  };
2437
2659
  }
2438
2660
  function parseGeminiStats(stats, modelHint, sessionId, timestamp) {
2439
- let models = isObject2(stats.models) ? stats.models : void 0;
2440
- return (models ? Object.entries(models) : [[modelHint ?? "unknown", stats]]).flatMap(([model, raw], index) => {
2661
+ let models2 = isObject2(stats.models) ? stats.models : void 0;
2662
+ return (models2 ? Object.entries(models2) : [[modelHint ?? "unknown", stats]]).flatMap(([model, raw], index) => {
2441
2663
  if (!isObject2(raw)) return [];
2442
2664
  let wrapped = isObject2(raw.tokens), source = wrapped ? raw.tokens : raw, inclusive = hasAny(source, ["prompt", "prompt_tokens", "input_tokens"]) || wrapped, tokens = extractTokenValues(source, inclusive);
2443
2665
  return tokenTotal(tokens) === 0 ? [] : [{ model, timestamp, tokens, dedupKey: `gemini:${sessionId}:stats:${model}:${index}:${timestamp.getTime()}` }];
@@ -3034,7 +3256,7 @@ async function extractModelFromTranscript(filePath) {
3034
3256
 
3035
3257
  // src/scanners/opencode.ts
3036
3258
  import { execFile } from "node:child_process";
3037
- import { readdir as readdir5, readFile as readFile10, realpath, stat as stat3 } from "node:fs/promises";
3259
+ import { readdir as readdir5, readFile as readFile10, realpath as realpath2, stat as stat3 } from "node:fs/promises";
3038
3260
  import { homedir as homedir12 } from "node:os";
3039
3261
  import { basename as basename9, dirname as dirname5, isAbsolute, join as join13, resolve as resolve2 } from "node:path";
3040
3262
  var nodeSqliteModulePromise, sqliteRuntimePromise;
@@ -3081,7 +3303,7 @@ async function discoverOpenCodeDatabases(dataDir, extraPaths = [], home = homedi
3081
3303
  for (let path of candidates.sort((a, b) => a.localeCompare(b)))
3082
3304
  try {
3083
3305
  if (!(await stat3(path)).isFile()) continue;
3084
- let canonical = await realpath(path).catch(() => path);
3306
+ let canonical = await realpath2(path).catch(() => path);
3085
3307
  if (seen.has(canonical)) continue;
3086
3308
  seen.add(canonical), result.push(path);
3087
3309
  } catch {
@@ -4365,7 +4587,7 @@ var en = {
4365
4587
  reportTitle: "AIUsage Report",
4366
4588
  period: "Period",
4367
4589
  events: "Events",
4368
- tokens: "Tokens",
4590
+ tokens: "Processed",
4369
4591
  cost: "Cost",
4370
4592
  pricing: "Pricing",
4371
4593
  sources: "Sources",
@@ -4394,7 +4616,7 @@ var en = {
4394
4616
  reportTitle: "AIUsage \u62A5\u544A",
4395
4617
  period: "\u65F6\u6BB5",
4396
4618
  events: "\u4E8B\u4EF6",
4397
- tokens: "\u4EE4\u724C",
4619
+ tokens: "\u5904\u7406 Token",
4398
4620
  cost: "\u8D39\u7528",
4399
4621
  pricing: "\u5B9A\u4EF7",
4400
4622
  sources: "\u6765\u6E90",
@@ -4822,7 +5044,7 @@ function handleCodexEvent(record, usageDate, projectFields, sessionId, filePath,
4822
5044
  }
4823
5045
  async function scanClaudeActivity(targetDates, options) {
4824
5046
  let acc = createAccumulator(targetDates, options.projectAliases), fileJobs = [];
4825
- for (let baseDir of getClaudeProjectDirs2(options.claudeProjectsDirs)) {
5047
+ for (let baseDir of getClaudeProjectDirs(options.claudeProjectsDirs)) {
4826
5048
  let projectDirs;
4827
5049
  try {
4828
5050
  projectDirs = await readdir7(baseDir, { withFileTypes: !0 });
@@ -4976,7 +5198,7 @@ async function collectCodexSessionFiles2(baseDir) {
4976
5198
  }
4977
5199
  return await walkJsonl(join17(baseDir, "sessions"), paths), paths;
4978
5200
  }
4979
- function getClaudeProjectDirs2(configured) {
5201
+ function getClaudeProjectDirs(configured) {
4980
5202
  if (configured?.length) return configured;
4981
5203
  let envVar = process.env.CLAUDE_CONFIG_DIR?.trim();
4982
5204
  if (envVar)
@@ -5608,6 +5830,7 @@ var msgs = {
5608
5830
  notInstalled: "Not installed",
5609
5831
  installedNoData: "Installed, no usage data yet",
5610
5832
  hasData: (n) => `${n} session${n > 1 ? "s" : ""} found`,
5833
+ hasDataInDirs: (n, dirs) => `${n} session${n > 1 ? "s" : ""} found across ${dirs} data director${dirs === 1 ? "y" : "ies"}`,
5611
5834
  openCodeData: (dbs, legacy) => `${dbs} database(s), ${legacy} legacy message(s) found`,
5612
5835
  openCodeSqliteUnavailable: "Database found, but this Node version requires the system sqlite3 executable",
5613
5836
  schedule: "Schedule",
@@ -5634,6 +5857,7 @@ var msgs = {
5634
5857
  notInstalled: "\u672A\u5B89\u88C5",
5635
5858
  installedNoData: "\u5DF2\u5B89\u88C5\uFF0C\u6682\u65E0\u4F7F\u7528\u6570\u636E",
5636
5859
  hasData: (n) => `\u53D1\u73B0 ${n} \u4E2A\u4F1A\u8BDD`,
5860
+ hasDataInDirs: (n, dirs) => `\u5728 ${dirs} \u4E2A\u6570\u636E\u76EE\u5F55\u4E2D\u53D1\u73B0 ${n} \u4E2A\u4F1A\u8BDD`,
5637
5861
  openCodeData: (dbs, legacy) => `\u53D1\u73B0 ${dbs} \u4E2A\u6570\u636E\u5E93\u3001${legacy} \u6761\u65E7\u7248\u6D88\u606F`,
5638
5862
  openCodeSqliteUnavailable: "\u5DF2\u53D1\u73B0\u6570\u636E\u5E93\uFF0C\u4F46\u5F53\u524D Node \u7248\u672C\u9700\u8981\u5B89\u88C5\u7CFB\u7EDF sqlite3 \u624D\u80FD\u8BFB\u53D6",
5639
5863
  schedule: "\u5B9A\u65F6\u540C\u6B65",
@@ -5683,7 +5907,7 @@ async function runDoctor(lang = "zh") {
5683
5907
  target.lastSuccessfulUploadAt ? checks.push({ group: g2, name: `${prefix} ${s.lastSync}`, status: "ok", message: target.lastSuccessfulUploadAt }) : checks.push({ group: g2, name: `${prefix} ${s.lastSync}`, status: "warn", message: s.lastSyncNone });
5684
5908
  }
5685
5909
  let g3 = s.groupTools, home = homedir19(), tools = [
5686
- { dirs: [join20(home, ".config", "claude", "projects"), join20(home, ".claude", "projects")], label: "Claude Code", exts: [".jsonl"] },
5910
+ { dirs: await discoverClaudeProjectDirs(), label: "Claude Code", exts: [".jsonl"] },
5687
5911
  { dirs: [join20(home, ".codex")], label: "Codex CLI", exts: [".jsonl"] },
5688
5912
  { dirs: [join20(home, "Library", "Application Support", "Cursor", "User", "globalStorage")], label: "Cursor", exts: [".vscdb"] },
5689
5913
  { dirs: [join20(home, ".copilot", "session-state"), join20(home, ".copilot", "otel")], label: "Copilot CLI", exts: [".jsonl"] },
@@ -5706,17 +5930,22 @@ async function runDoctor(lang = "zh") {
5706
5930
  { dirs: [resolveTraeNativeCacheDir(home), resolveTokscaleTraeCacheDir(home)], label: "Trae", exts: [".json"] }
5707
5931
  ];
5708
5932
  for (let tool of tools) {
5709
- let installed = !1, n = 0;
5933
+ let installed = !1, installedDirs = 0, n = 0;
5710
5934
  for (let dir of tool.dirs)
5711
5935
  try {
5712
- await stat5(dir), installed = !0, n += await countFiles(dir, tool.exts);
5936
+ await stat5(dir), installed = !0, installedDirs++, n += await countFiles(dir, tool.exts);
5713
5937
  } catch {
5714
5938
  }
5715
5939
  if (!installed) {
5716
5940
  checks.push({ group: g3, name: tool.label, status: "warn", message: s.notInstalled });
5717
5941
  continue;
5718
5942
  }
5719
- n > 0 ? checks.push({ group: g3, name: tool.label, status: "ok", message: s.hasData(n) }) : checks.push({ group: g3, name: tool.label, status: "warn", message: s.installedNoData });
5943
+ n > 0 ? checks.push({
5944
+ group: g3,
5945
+ name: tool.label,
5946
+ status: "ok",
5947
+ message: tool.label === "Claude Code" ? s.hasDataInDirs(n, installedDirs) : s.hasData(n)
5948
+ }) : checks.push({ group: g3, name: tool.label, status: "warn", message: s.installedNoData });
5720
5949
  }
5721
5950
  let openCodeSources = await resolveOpenCodeSources({
5722
5951
  dbPaths: config.scanner?.opencodeDbPaths
@@ -6116,22 +6345,22 @@ var CACHE_DIR = join22(homedir21(), ".aiusage"), CACHE_PATH = join22(CACHE_DIR,
6116
6345
  "https://unpkg.com/@aiusage/pricing@latest/catalog.json"
6117
6346
  ];
6118
6347
  async function resolvePricingCatalog(config, options = {}) {
6119
- let mode = config.pricing?.mode ?? "auto", cache = await readPricingCache(), ttlHours = config.pricing?.cacheTtlHours ?? DEFAULT_CACHE_TTL_HOURS;
6348
+ let mode = config.pricing?.mode ?? "auto", cache = await readPricingCache(), ttlHours = config.pricing?.cacheTtlHours ?? DEFAULT_CACHE_TTL_HOURS, preferNewer = (resolved) => mode === "auto" && !options.explicitUrl && isOlderVersion(resolved.info.version, catalog.version) ? { catalog, info: { source: "bundled", version: catalog.version } } : resolved;
6120
6349
  if (!options.forceRefresh && cache && (mode === "manual" || mode === "offline" || isCacheFresh(cache, ttlHours)))
6121
- return fromCache(cache);
6350
+ return preferNewer(fromCache(cache));
6122
6351
  if ((mode !== "offline" || options.forceRefresh) && (mode === "auto" || options.forceRefresh)) {
6123
6352
  let candidates = getPricingUrls(config, options);
6124
6353
  for (let url of candidates)
6125
6354
  try {
6126
6355
  let catalog2 = await fetchPricingCatalog(url), fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
6127
- return await writePricingCache({ fetchedAt, sourceUrl: url, catalog: catalog2 }), {
6356
+ return await writePricingCache({ fetchedAt, sourceUrl: url, catalog: catalog2 }), preferNewer({
6128
6357
  catalog: catalog2,
6129
6358
  info: { source: "remote", version: catalog2.version, url, fetchedAt }
6130
- };
6359
+ });
6131
6360
  } catch {
6132
6361
  }
6133
6362
  }
6134
- return cache ? fromCache(cache) : {
6363
+ return cache ? preferNewer(fromCache(cache)) : {
6135
6364
  catalog,
6136
6365
  info: { source: "bundled", version: catalog.version }
6137
6366
  };
@@ -6161,6 +6390,9 @@ function getPricingUrls(config, options) {
6161
6390
  ].filter((url) => !!url);
6162
6391
  return [...new Set(urls.map((url) => url.trim()).filter(Boolean))];
6163
6392
  }
6393
+ function isOlderVersion(version, than) {
6394
+ return version.localeCompare(than) < 0;
6395
+ }
6164
6396
  function isCacheFresh(cache, ttlHours) {
6165
6397
  let fetched = new Date(cache.fetchedAt).getTime();
6166
6398
  return Number.isFinite(fetched) ? Date.now() - fetched < ttlHours * 60 * 60 * 1e3 : !1;
@@ -7116,8 +7348,8 @@ await (async () => {
7116
7348
  await runImport(parsed.flags, parsed.positionals);
7117
7349
  } else if (command === "setup")
7118
7350
  console.log(`To deploy the server, clone the repo and run the setup wizard:
7119
- `), console.log(" git clone https://github.com/ennann/aiusage.git"), console.log(" cd aiusage && pnpm install"), console.log(` pnpm setup
7120
- `), console.log("See: https://github.com/ennann/aiusage#deploy-your-own-server");
7351
+ `), console.log(" git clone https://github.com/imetn/aiusage.git"), console.log(" cd aiusage && pnpm install"), console.log(` pnpm setup
7352
+ `), console.log("See: https://github.com/imetn/aiusage#deploy-your-own-server");
7121
7353
  else if (command === "--help" || command === "-h" || command === "help") {
7122
7354
  let zh2 = (await readConfig()).lang === "zh";
7123
7355
  printHelp(zh2);
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@aiusage/cli",
3
- "version": "1.7.9",
3
+ "version": "1.7.14",
4
4
  "description": "Track and sync AI tool token usage across devices.",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/ennann/aiusage.git",
9
+ "url": "git+https://github.com/imetn/aiusage.git",
10
10
  "directory": "packages/cli"
11
11
  },
12
- "homepage": "https://github.com/ennann/aiusage",
12
+ "homepage": "https://github.com/imetn/aiusage",
13
13
  "bugs": {
14
- "url": "https://github.com/ennann/aiusage/issues"
14
+ "url": "https://github.com/imetn/aiusage/issues"
15
15
  },
16
16
  "type": "module",
17
17
  "publishConfig": {
@@ -1,9 +1,13 @@
1
1
  {
2
- "version": "2026-07-20-gpt-5.6-kimi-k3-v1",
2
+ "version": "2026-09-24-gpt-6-opus-5-5-grok-4-7-v1",
3
3
  "fx": {
4
4
  "CNY": 7.2
5
5
  },
6
6
  "aliases": {
7
+ "claude-fibre-5": "claude-fable-5",
8
+ "claude-fiber-5": "claude-fable-5",
9
+ "claude-ops-5": "claude-opus-5",
10
+ "claude-opus-5.5": "claude-opus-5-5",
7
11
  "claude-opus-4-7-20260201": "claude-opus-4-7",
8
12
  "claude-sonnet-4-6-20250301": "claude-sonnet-4-6",
9
13
  "claude-opus-4-6-20250301": "claude-opus-4-6",
@@ -18,6 +22,49 @@
18
22
  "anthropic": {
19
23
  "claude-code": {
20
24
  "models": {
25
+ "claude-fable-5-1": {
26
+ "currency": "USD",
27
+ "effective_from": "2026-09-01",
28
+ "input_per_million": 10,
29
+ "output_per_million": 50,
30
+ "cache_write_5m_per_million": 12.5,
31
+ "cache_write_1h_per_million": 20,
32
+ "cached_input_per_million": 0.25
33
+ },
34
+ "claude-fable-5": {
35
+ "currency": "USD",
36
+ "input_per_million": 10,
37
+ "output_per_million": 50,
38
+ "cache_write_5m_per_million": 12.5,
39
+ "cache_write_1h_per_million": 20,
40
+ "cached_input_per_million": 1
41
+ },
42
+ "claude-mythos-5": {
43
+ "currency": "USD",
44
+ "notes": "limited availability",
45
+ "input_per_million": 10,
46
+ "output_per_million": 50,
47
+ "cache_write_5m_per_million": 12.5,
48
+ "cache_write_1h_per_million": 20,
49
+ "cached_input_per_million": 1
50
+ },
51
+ "claude-opus-5-5": {
52
+ "currency": "USD",
53
+ "effective_from": "2026-09-22",
54
+ "input_per_million": 4,
55
+ "output_per_million": 20,
56
+ "cache_write_5m_per_million": 5,
57
+ "cache_write_1h_per_million": 8,
58
+ "cached_input_per_million": 0.2
59
+ },
60
+ "claude-opus-5": {
61
+ "currency": "USD",
62
+ "input_per_million": 5,
63
+ "output_per_million": 25,
64
+ "cache_write_5m_per_million": 6.25,
65
+ "cache_write_1h_per_million": 10,
66
+ "cached_input_per_million": 0.5
67
+ },
21
68
  "claude-opus-4-8": {
22
69
  "currency": "USD",
23
70
  "input_per_million": 5,
@@ -67,6 +114,16 @@
67
114
  "cache_write_1h_per_million": 30,
68
115
  "cached_input_per_million": 1.5
69
116
  },
117
+ "claude-sonnet-5": {
118
+ "currency": "USD",
119
+ "effective_to": "2026-08-31",
120
+ "notes": "introductory pricing through 2026-08-31; standard pricing is $3 input / $15 output from 2026-09-01",
121
+ "input_per_million": 2,
122
+ "output_per_million": 10,
123
+ "cache_write_5m_per_million": 2.5,
124
+ "cache_write_1h_per_million": 4,
125
+ "cached_input_per_million": 0.2
126
+ },
70
127
  "claude-sonnet-4-6": {
71
128
  "currency": "USD",
72
129
  "input_per_million": 3,
@@ -115,72 +172,141 @@
115
172
  "openai": {
116
173
  "codex": {
117
174
  "models": {
118
- "gpt-5.6-sol": {
175
+ "gpt-6-astra": {
119
176
  "currency": "USD",
120
177
  "notes": "prompts over 272K input tokens bill the full request at long-context rates",
121
- "input_per_million": 5,
122
- "cached_input_per_million": 0.5,
123
- "cache_write_per_million": 6.25,
124
- "output_per_million": 30,
178
+ "input_per_million": 10,
179
+ "cached_input_per_million": 1,
180
+ "cache_write_per_million": 12.5,
181
+ "output_per_million": 50,
125
182
  "tiers": [
126
183
  {
127
184
  "threshold": 272000,
128
- "input_per_million": 5,
129
- "cached_input_per_million": 0.5,
130
- "cache_write_per_million": 6.25,
131
- "output_per_million": 30
132
- },
133
- {
134
185
  "input_per_million": 10,
135
186
  "cached_input_per_million": 1,
136
187
  "cache_write_per_million": 12.5,
137
- "output_per_million": 45
188
+ "output_per_million": 50
189
+ },
190
+ {
191
+ "input_per_million": 20,
192
+ "cached_input_per_million": 2,
193
+ "cache_write_per_million": 25,
194
+ "output_per_million": 75
138
195
  }
139
196
  ]
140
197
  },
141
- "gpt-5.6-terra": {
198
+ "gpt-6-sol": {
142
199
  "currency": "USD",
143
200
  "notes": "prompts over 272K input tokens bill the full request at long-context rates",
144
- "input_per_million": 2.5,
145
- "cached_input_per_million": 0.25,
146
- "cache_write_per_million": 3.125,
147
- "output_per_million": 15,
201
+ "input_per_million": 2,
202
+ "cached_input_per_million": 0.2,
203
+ "cache_write_per_million": 2.5,
204
+ "output_per_million": 10,
148
205
  "tiers": [
149
206
  {
150
207
  "threshold": 272000,
151
- "input_per_million": 2.5,
152
- "cached_input_per_million": 0.25,
153
- "cache_write_per_million": 3.125,
154
- "output_per_million": 15
208
+ "input_per_million": 2,
209
+ "cached_input_per_million": 0.2,
210
+ "cache_write_per_million": 2.5,
211
+ "output_per_million": 10
155
212
  },
156
213
  {
157
- "input_per_million": 5,
158
- "cached_input_per_million": 0.5,
159
- "cache_write_per_million": 6.25,
160
- "output_per_million": 22.5
214
+ "input_per_million": 4,
215
+ "cached_input_per_million": 0.4,
216
+ "cache_write_per_million": 5,
217
+ "output_per_million": 15
161
218
  }
162
219
  ]
163
220
  },
164
- "gpt-5.6-luna": {
221
+ "gpt-6-luna": {
165
222
  "currency": "USD",
166
223
  "notes": "prompts over 272K input tokens bill the full request at long-context rates",
167
- "input_per_million": 1,
168
- "cached_input_per_million": 0.1,
169
- "cache_write_per_million": 1.25,
170
- "output_per_million": 6,
224
+ "input_per_million": 0.1,
225
+ "cached_input_per_million": 0.01,
226
+ "cache_write_per_million": 0.125,
227
+ "output_per_million": 0.5,
171
228
  "tiers": [
172
229
  {
173
230
  "threshold": 272000,
174
- "input_per_million": 1,
175
- "cached_input_per_million": 0.1,
176
- "cache_write_per_million": 1.25,
177
- "output_per_million": 6
231
+ "input_per_million": 0.1,
232
+ "cached_input_per_million": 0.01,
233
+ "cache_write_per_million": 0.125,
234
+ "output_per_million": 0.5
178
235
  },
179
236
  {
237
+ "input_per_million": 0.2,
238
+ "cached_input_per_million": 0.02,
239
+ "cache_write_per_million": 0.25,
240
+ "output_per_million": 0.75
241
+ }
242
+ ]
243
+ },
244
+ "gpt-5.6-sol": {
245
+ "currency": "USD",
246
+ "notes": "promotional pricing available at least through 2026-11-21; prompts over 272K input tokens bill the full request at long-context rates",
247
+ "input_per_million": 4,
248
+ "cached_input_per_million": 0.4,
249
+ "cache_write_per_million": 5,
250
+ "output_per_million": 20,
251
+ "tiers": [
252
+ {
253
+ "threshold": 272000,
254
+ "input_per_million": 4,
255
+ "cached_input_per_million": 0.4,
256
+ "cache_write_per_million": 5,
257
+ "output_per_million": 20
258
+ },
259
+ {
260
+ "input_per_million": 8,
261
+ "cached_input_per_million": 0.8,
262
+ "cache_write_per_million": 10,
263
+ "output_per_million": 30
264
+ }
265
+ ]
266
+ },
267
+ "gpt-5.6-terra": {
268
+ "currency": "USD",
269
+ "notes": "prompts over 272K input tokens bill the full request at long-context rates",
270
+ "input_per_million": 2,
271
+ "cached_input_per_million": 0.2,
272
+ "cache_write_per_million": 2.5,
273
+ "output_per_million": 12,
274
+ "tiers": [
275
+ {
276
+ "threshold": 272000,
180
277
  "input_per_million": 2,
181
278
  "cached_input_per_million": 0.2,
182
279
  "cache_write_per_million": 2.5,
183
- "output_per_million": 9
280
+ "output_per_million": 12
281
+ },
282
+ {
283
+ "input_per_million": 4,
284
+ "cached_input_per_million": 0.4,
285
+ "cache_write_per_million": 5,
286
+ "output_per_million": 18
287
+ }
288
+ ]
289
+ },
290
+ "gpt-5.6-luna": {
291
+ "currency": "USD",
292
+ "notes": "prompts over 272K input tokens bill the full request at long-context rates",
293
+ "input_per_million": 0.2,
294
+ "cached_input_per_million": 0.02,
295
+ "cache_write_per_million": 0.25,
296
+ "output_per_million": 1.2,
297
+ "tiers": [
298
+ {
299
+ "threshold": 272000,
300
+ "input_per_million": 0.2,
301
+ "cached_input_per_million": 0.02,
302
+ "cache_write_per_million": 0.25,
303
+ "output_per_million": 1.2
304
+ },
305
+ {
306
+ "input_per_million": 0.4,
307
+ "cached_input_per_million": 0.04,
308
+ "cache_write_per_million": 0.5,
309
+ "output_per_million": 1.8
184
310
  }
185
311
  ]
186
312
  },
@@ -1193,6 +1319,31 @@
1193
1319
  "cached_input_per_million": 0.075,
1194
1320
  "output_per_million": 0.6
1195
1321
  },
1322
+ "claude-fable-5": {
1323
+ "currency": "USD",
1324
+ "input_per_million": 10,
1325
+ "cached_input_per_million": 1,
1326
+ "output_per_million": 50
1327
+ },
1328
+ "claude-mythos-5": {
1329
+ "currency": "USD",
1330
+ "input_per_million": 10,
1331
+ "cached_input_per_million": 1,
1332
+ "output_per_million": 50
1333
+ },
1334
+ "claude-opus-5": {
1335
+ "currency": "USD",
1336
+ "input_per_million": 5,
1337
+ "cached_input_per_million": 0.5,
1338
+ "output_per_million": 25
1339
+ },
1340
+ "claude-sonnet-5": {
1341
+ "currency": "USD",
1342
+ "notes": "introductory pricing through 2026-08-31; standard pricing is $3 input / $15 output from 2026-09-01",
1343
+ "input_per_million": 2,
1344
+ "cached_input_per_million": 0.2,
1345
+ "output_per_million": 10
1346
+ },
1196
1347
  "claude-sonnet-4": {
1197
1348
  "currency": "USD",
1198
1349
  "input_per_million": 3,
@@ -1223,6 +1374,13 @@
1223
1374
  "sourcegraph": {
1224
1375
  "amp": {
1225
1376
  "models": {
1377
+ "claude-sonnet-5": {
1378
+ "currency": "USD",
1379
+ "notes": "introductory pricing through 2026-08-31; standard pricing is $3 input / $15 output from 2026-09-01",
1380
+ "input_per_million": 2,
1381
+ "cached_input_per_million": 0.2,
1382
+ "output_per_million": 10
1383
+ },
1226
1384
  "claude-sonnet-4": {
1227
1385
  "currency": "USD",
1228
1386
  "input_per_million": 3,
@@ -1244,6 +1402,62 @@
1244
1402
  }
1245
1403
  }
1246
1404
  },
1405
+ "xai": {
1406
+ "opencode": {
1407
+ "models": {
1408
+ "grok-4.7": {
1409
+ "currency": "USD",
1410
+ "notes": "prompts of 200K+ input tokens bill the full request at long-context rates; -fast is 2x",
1411
+ "input_per_million": 2,
1412
+ "cached_input_per_million": 0.5,
1413
+ "cache_write_per_million": 2,
1414
+ "output_per_million": 6,
1415
+ "tiers": [
1416
+ {
1417
+ "threshold": 199999,
1418
+ "input_per_million": 2,
1419
+ "cached_input_per_million": 0.5,
1420
+ "cache_write_per_million": 2,
1421
+ "output_per_million": 6
1422
+ },
1423
+ {
1424
+ "input_per_million": 4,
1425
+ "cached_input_per_million": 1,
1426
+ "cache_write_per_million": 4,
1427
+ "output_per_million": 12
1428
+ }
1429
+ ]
1430
+ }
1431
+ }
1432
+ },
1433
+ "copilot-cli": {
1434
+ "models": {
1435
+ "grok-4.7": {
1436
+ "currency": "USD",
1437
+ "notes": "prompts of 200K+ input tokens bill the full request at long-context rates; -fast is 2x",
1438
+ "input_per_million": 2,
1439
+ "cached_input_per_million": 0.5,
1440
+ "cache_write_per_million": 2,
1441
+ "output_per_million": 6,
1442
+ "tiers": [
1443
+ {
1444
+ "threshold": 199999,
1445
+ "input_per_million": 2,
1446
+ "cached_input_per_million": 0.5,
1447
+ "cache_write_per_million": 2,
1448
+ "output_per_million": 6
1449
+ },
1450
+ {
1451
+ "input_per_million": 4,
1452
+ "cached_input_per_million": 1,
1453
+ "cache_write_per_million": 4,
1454
+ "output_per_million": 12
1455
+ }
1456
+ ]
1457
+ }
1458
+ }
1459
+ }
1460
+ },
1247
1461
  "inflection": {
1248
1462
  "pi": {
1249
1463
  "models": {}