@aiusage/cli 1.7.10 → 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,15 @@ 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
+ },
366
411
  "claude-fable-5": {
367
412
  currency: "USD",
368
413
  input_per_million: 10,
@@ -380,6 +425,15 @@ var anthropic = {
380
425
  cache_write_1h_per_million: 20,
381
426
  cached_input_per_million: 1
382
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
+ },
383
437
  "claude-opus-5": {
384
438
  currency: "USD",
385
439
  input_per_million: 5,
@@ -497,73 +551,143 @@ var anthropic = {
497
551
  var openai = {
498
552
  codex: {
499
553
  models: {
500
- // ── GPT-5.6 系列 ──
501
- "gpt-5.6-sol": {
554
+ // ── GPT-6 系列 ──
555
+ "gpt-6-astra": {
502
556
  currency: "USD",
503
557
  notes: "prompts over 272K input tokens bill the full request at long-context rates",
504
- input_per_million: 5,
505
- cached_input_per_million: 0.5,
506
- cache_write_per_million: 6.25,
507
- 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,
508
562
  tiers: [
509
563
  {
510
564
  threshold: 272e3,
511
- input_per_million: 5,
512
- cached_input_per_million: 0.5,
513
- cache_write_per_million: 6.25,
514
- output_per_million: 30
515
- },
516
- {
517
565
  input_per_million: 10,
518
566
  cached_input_per_million: 1,
519
567
  cache_write_per_million: 12.5,
520
- 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
521
575
  }
522
576
  ]
523
577
  },
524
- "gpt-5.6-terra": {
578
+ "gpt-6-sol": {
525
579
  currency: "USD",
526
580
  notes: "prompts over 272K input tokens bill the full request at long-context rates",
527
- input_per_million: 2.5,
528
- cached_input_per_million: 0.25,
529
- cache_write_per_million: 3.125,
530
- 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,
531
585
  tiers: [
532
586
  {
533
587
  threshold: 272e3,
534
- input_per_million: 2.5,
535
- cached_input_per_million: 0.25,
536
- cache_write_per_million: 3.125,
537
- 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
538
592
  },
539
593
  {
540
- input_per_million: 5,
541
- cached_input_per_million: 0.5,
542
- cache_write_per_million: 6.25,
543
- 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
544
598
  }
545
599
  ]
546
600
  },
547
- "gpt-5.6-luna": {
601
+ "gpt-6-luna": {
548
602
  currency: "USD",
549
603
  notes: "prompts over 272K input tokens bill the full request at long-context rates",
550
- input_per_million: 1,
551
- cached_input_per_million: 0.1,
552
- cache_write_per_million: 1.25,
553
- 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,
554
608
  tiers: [
555
609
  {
556
610
  threshold: 272e3,
557
- input_per_million: 1,
558
- cached_input_per_million: 0.1,
559
- cache_write_per_million: 1.25,
560
- output_per_million: 6
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
561
615
  },
562
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,
632
+ tiers: [
633
+ {
634
+ threshold: 272e3,
635
+ input_per_million: 4,
636
+ cached_input_per_million: 0.4,
637
+ cache_write_per_million: 5,
638
+ output_per_million: 20
639
+ },
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,
563
658
  input_per_million: 2,
564
659
  cached_input_per_million: 0.2,
565
660
  cache_write_per_million: 2.5,
566
- 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
567
691
  }
568
692
  ]
569
693
  },
@@ -1350,6 +1474,36 @@ var sourcegraph = {
1350
1474
  }
1351
1475
  };
1352
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
+
1353
1507
  // ../shared/src/pricing/data/placeholders.ts
1354
1508
  var inflection = {
1355
1509
  pi: { models: {} }
@@ -1362,10 +1516,11 @@ var inflection = {
1362
1516
  };
1363
1517
 
1364
1518
  // ../shared/src/pricing/catalog.ts
1365
- var PRICING_VERSION = "2026-07-26-claude-5-v1", aliases = {
1519
+ var PRICING_VERSION = "2026-09-24-gpt-6-opus-5-5-grok-4-7-v1", aliases = {
1366
1520
  "claude-fibre-5": "claude-fable-5",
1367
1521
  "claude-fiber-5": "claude-fable-5",
1368
1522
  "claude-ops-5": "claude-opus-5",
1523
+ "claude-opus-5.5": "claude-opus-5-5",
1369
1524
  "claude-opus-4-7-20260201": "claude-opus-4-7",
1370
1525
  "claude-sonnet-4-6-20250301": "claude-sonnet-4-6",
1371
1526
  "claude-opus-4-6-20250301": "claude-opus-4-6",
@@ -1392,6 +1547,7 @@ var PRICING_VERSION = "2026-07-26-claude-5-v1", aliases = {
1392
1547
  zhipu,
1393
1548
  github,
1394
1549
  sourcegraph,
1550
+ xai,
1395
1551
  inflection,
1396
1552
  cursor,
1397
1553
  droid,
@@ -1400,11 +1556,16 @@ var PRICING_VERSION = "2026-07-26-claude-5-v1", aliases = {
1400
1556
  };
1401
1557
 
1402
1558
  // ../shared/src/pricing/calculate.ts
1403
- var ANTHROPIC_FAST_MULTIPLIERS = {
1559
+ var FAST_MULTIPLIERS = {
1560
+ "claude-opus-5-5": 2,
1404
1561
  "claude-opus-5": 2,
1405
1562
  "claude-opus-4-8": 2,
1406
- "claude-opus-4-7": 6
1563
+ "claude-opus-4-7": 6,
1564
+ "grok-4.7": 2
1407
1565
  }, OPENAI_CODEX_TIER_MULTIPLIERS = {
1566
+ "gpt-6-astra": 2,
1567
+ "gpt-6-sol": 2,
1568
+ "gpt-6-luna": 2,
1408
1569
  "gpt-5.6-sol": 2,
1409
1570
  "gpt-5.6-terra": 2,
1410
1571
  "gpt-5.6-luna": 2,
@@ -1415,21 +1576,21 @@ function splitServiceTierSuffix(model) {
1415
1576
  return model.endsWith("-priority") ? { baseModel: model.replace(/-priority$/, ""), tier: "priority" } : model.endsWith("-fast") ? { baseModel: model.replace(/-fast$/, ""), tier: "fast" } : { baseModel: model, tier: null };
1416
1577
  }
1417
1578
  function getServiceTierMultiplier(provider, product, resolvedModel, tier) {
1418
- return tier ? provider === "openai" && product === "codex" ? tier === "fast" && resolvedModel.startsWith("gpt-5.6-") ? 1 : OPENAI_CODEX_TIER_MULTIPLIERS[resolvedModel] ?? 1 : tier === "fast" ? ANTHROPIC_FAST_MULTIPLIERS[resolvedModel] ?? 1 : 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;
1419
1580
  }
1420
1581
  function resolveModelPricing(catalog2, provider, product, model) {
1421
- let models = catalog2.providers[provider]?.[product]?.models;
1422
- if (!models) return null;
1582
+ let models2 = catalog2.providers[provider]?.[product]?.models;
1583
+ if (!models2) return null;
1423
1584
  let aliasResolved = catalog2.aliases[model];
1424
- if (aliasResolved && models[aliasResolved])
1425
- return { resolvedModel: aliasResolved, pricing: models[aliasResolved], normalized: !1 };
1426
- if (models[model])
1427
- return { resolvedModel: model, pricing: models[model], normalized: !1 };
1428
- 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)) {
1429
1590
  if (!model.startsWith(`${knownModel}-`)) continue;
1430
1591
  let suffix = model.slice(knownModel.length + 1);
1431
1592
  if (!/^\d+(?:[-.]\d+)*(?:-\d{6,8})?$/.test(suffix))
1432
- return { resolvedModel: knownModel, pricing: models[knownModel], normalized: !0 };
1593
+ return { resolvedModel: knownModel, pricing: models2[knownModel], normalized: !0 };
1433
1594
  }
1434
1595
  return null;
1435
1596
  }
@@ -1560,14 +1721,16 @@ async function processCodexFile(filePath, projectAliases, serviceTier) {
1560
1721
  state.previousTotals = parsed.nextTotals;
1561
1722
  continue;
1562
1723
  }
1563
- let { tokens, nextTotals } = parsed, cachedInput = Math.min(tokens.cached, tokens.input), nonCachedInput = Math.max(tokens.input - cachedInput, 0), output = tokens.output, reasoning = tokens.reasoning;
1564
- 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;
1565
1726
  state.previousTotals = nextTotals;
1566
- 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, {
1567
1728
  inputTokens: nonCachedInput,
1568
1729
  cachedInputTokens: cachedInput,
1569
- cacheWriteTokens: 0,
1570
- 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
1571
1734
  }), exactEventCost = eventCost.costStatus === "exact" ? eventCost.estimatedCostUsd : void 0;
1572
1735
  events.push({
1573
1736
  usageDate,
@@ -1576,6 +1739,7 @@ async function processCodexFile(filePath, projectAliases, serviceTier) {
1576
1739
  projectFields: { ...state.projectFields },
1577
1740
  inputTokens: nonCachedInput,
1578
1741
  cachedInputTokens: cachedInput,
1742
+ cacheWriteTokens: cacheWriteInput,
1579
1743
  outputTokens: output,
1580
1744
  reasoningOutputTokens: reasoning,
1581
1745
  costUSD: exactEventCost,
@@ -1593,7 +1757,7 @@ function mergeCodexEvent(groupedByDate, event) {
1593
1757
  if (!grouped) return;
1594
1758
  let key = `${event.model}|${event.projectFields.project}`, existing = grouped.get(key);
1595
1759
  if (existing) {
1596
- 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);
1597
1761
  return;
1598
1762
  }
1599
1763
  let breakdown = {
@@ -1607,7 +1771,7 @@ function mergeCodexEvent(groupedByDate, event) {
1607
1771
  eventCount: 1,
1608
1772
  inputTokens: event.inputTokens,
1609
1773
  cachedInputTokens: event.cachedInputTokens,
1610
- cacheWriteTokens: 0,
1774
+ cacheWriteTokens: event.cacheWriteTokens,
1611
1775
  outputTokens: event.outputTokens,
1612
1776
  reasoningOutputTokens: event.reasoningOutputTokens
1613
1777
  };
@@ -1635,18 +1799,20 @@ function totalsFromUsage(usage) {
1635
1799
  clampToken2(usage.cached_input_tokens),
1636
1800
  clampToken2(usage.cache_read_input_tokens)
1637
1801
  ),
1802
+ cacheWrite: clampToken2(usage.cache_write_input_tokens),
1638
1803
  output: clampToken2(usage.output_tokens),
1639
1804
  reasoning: clampToken2(usage.reasoning_output_tokens)
1640
1805
  };
1641
1806
  }
1642
1807
  function totalsEqual(a, b) {
1643
- 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;
1644
1809
  }
1645
1810
  function totalsDelta(current, previous) {
1646
- 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))
1647
1812
  return {
1648
1813
  input: current.input - previous.input,
1649
1814
  cached: current.cached - previous.cached,
1815
+ cacheWrite: current.cacheWrite - previous.cacheWrite,
1650
1816
  output: current.output - previous.output,
1651
1817
  reasoning: current.reasoning - previous.reasoning
1652
1818
  };
@@ -1655,12 +1821,13 @@ function totalsAdd(a, b) {
1655
1821
  return {
1656
1822
  input: a.input + b.input,
1657
1823
  cached: a.cached + b.cached,
1824
+ cacheWrite: a.cacheWrite + b.cacheWrite,
1658
1825
  output: a.output + b.output,
1659
1826
  reasoning: a.reasoning + b.reasoning
1660
1827
  };
1661
1828
  }
1662
1829
  function totalsSum(value) {
1663
- return value.input + value.cached + value.output + value.reasoning;
1830
+ return value.input + value.cached + value.cacheWrite + value.output + value.reasoning;
1664
1831
  }
1665
1832
  function looksLikeStaleRegression(current, previous, last) {
1666
1833
  let previousSum = totalsSum(previous), currentSum = totalsSum(current), lastSum = totalsSum(last);
@@ -1689,7 +1856,7 @@ function shouldSkipInheritedSnapshot(state, usage, totals) {
1689
1856
  let reported = usage ? reportedTotalTokens(usage) : void 0;
1690
1857
  if (reported != null && state.inheritedReportedTotal != null && reported <= state.inheritedReportedTotal) return !0;
1691
1858
  let baseline = state.inheritedBaseline;
1692
- 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);
1693
1860
  }
1694
1861
  function reportedTotalTokens(usage) {
1695
1862
  return typeof usage.total_tokens == "number" && usage.total_tokens >= 0 ? usage.total_tokens : void 0;
@@ -1738,7 +1905,7 @@ async function detectCodexServiceTier(baseDir) {
1738
1905
  }
1739
1906
  function applyCodexServiceTier(model, serviceTier) {
1740
1907
  if (!serviceTier || model.endsWith("-fast") || model.endsWith("-priority")) return model;
1741
- 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";
1742
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;
1743
1910
  }
1744
1911
  async function walkDir(dir, result) {
@@ -2491,8 +2658,8 @@ function parseDirectGeminiEvent(value, modelHint, sessionId, fallbackTs) {
2491
2658
  };
2492
2659
  }
2493
2660
  function parseGeminiStats(stats, modelHint, sessionId, timestamp) {
2494
- let models = isObject2(stats.models) ? stats.models : void 0;
2495
- 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) => {
2496
2663
  if (!isObject2(raw)) return [];
2497
2664
  let wrapped = isObject2(raw.tokens), source = wrapped ? raw.tokens : raw, inclusive = hasAny(source, ["prompt", "prompt_tokens", "input_tokens"]) || wrapped, tokens = extractTokenValues(source, inclusive);
2498
2665
  return tokenTotal(tokens) === 0 ? [] : [{ model, timestamp, tokens, dedupKey: `gemini:${sessionId}:stats:${model}:${index}:${timestamp.getTime()}` }];
@@ -3089,7 +3256,7 @@ async function extractModelFromTranscript(filePath) {
3089
3256
 
3090
3257
  // src/scanners/opencode.ts
3091
3258
  import { execFile } from "node:child_process";
3092
- 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";
3093
3260
  import { homedir as homedir12 } from "node:os";
3094
3261
  import { basename as basename9, dirname as dirname5, isAbsolute, join as join13, resolve as resolve2 } from "node:path";
3095
3262
  var nodeSqliteModulePromise, sqliteRuntimePromise;
@@ -3136,7 +3303,7 @@ async function discoverOpenCodeDatabases(dataDir, extraPaths = [], home = homedi
3136
3303
  for (let path of candidates.sort((a, b) => a.localeCompare(b)))
3137
3304
  try {
3138
3305
  if (!(await stat3(path)).isFile()) continue;
3139
- let canonical = await realpath(path).catch(() => path);
3306
+ let canonical = await realpath2(path).catch(() => path);
3140
3307
  if (seen.has(canonical)) continue;
3141
3308
  seen.add(canonical), result.push(path);
3142
3309
  } catch {
@@ -4420,7 +4587,7 @@ var en = {
4420
4587
  reportTitle: "AIUsage Report",
4421
4588
  period: "Period",
4422
4589
  events: "Events",
4423
- tokens: "Tokens",
4590
+ tokens: "Processed",
4424
4591
  cost: "Cost",
4425
4592
  pricing: "Pricing",
4426
4593
  sources: "Sources",
@@ -4449,7 +4616,7 @@ var en = {
4449
4616
  reportTitle: "AIUsage \u62A5\u544A",
4450
4617
  period: "\u65F6\u6BB5",
4451
4618
  events: "\u4E8B\u4EF6",
4452
- tokens: "\u4EE4\u724C",
4619
+ tokens: "\u5904\u7406 Token",
4453
4620
  cost: "\u8D39\u7528",
4454
4621
  pricing: "\u5B9A\u4EF7",
4455
4622
  sources: "\u6765\u6E90",
@@ -4877,7 +5044,7 @@ function handleCodexEvent(record, usageDate, projectFields, sessionId, filePath,
4877
5044
  }
4878
5045
  async function scanClaudeActivity(targetDates, options) {
4879
5046
  let acc = createAccumulator(targetDates, options.projectAliases), fileJobs = [];
4880
- for (let baseDir of getClaudeProjectDirs2(options.claudeProjectsDirs)) {
5047
+ for (let baseDir of getClaudeProjectDirs(options.claudeProjectsDirs)) {
4881
5048
  let projectDirs;
4882
5049
  try {
4883
5050
  projectDirs = await readdir7(baseDir, { withFileTypes: !0 });
@@ -5031,7 +5198,7 @@ async function collectCodexSessionFiles2(baseDir) {
5031
5198
  }
5032
5199
  return await walkJsonl(join17(baseDir, "sessions"), paths), paths;
5033
5200
  }
5034
- function getClaudeProjectDirs2(configured) {
5201
+ function getClaudeProjectDirs(configured) {
5035
5202
  if (configured?.length) return configured;
5036
5203
  let envVar = process.env.CLAUDE_CONFIG_DIR?.trim();
5037
5204
  if (envVar)
@@ -5663,6 +5830,7 @@ var msgs = {
5663
5830
  notInstalled: "Not installed",
5664
5831
  installedNoData: "Installed, no usage data yet",
5665
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"}`,
5666
5834
  openCodeData: (dbs, legacy) => `${dbs} database(s), ${legacy} legacy message(s) found`,
5667
5835
  openCodeSqliteUnavailable: "Database found, but this Node version requires the system sqlite3 executable",
5668
5836
  schedule: "Schedule",
@@ -5689,6 +5857,7 @@ var msgs = {
5689
5857
  notInstalled: "\u672A\u5B89\u88C5",
5690
5858
  installedNoData: "\u5DF2\u5B89\u88C5\uFF0C\u6682\u65E0\u4F7F\u7528\u6570\u636E",
5691
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`,
5692
5861
  openCodeData: (dbs, legacy) => `\u53D1\u73B0 ${dbs} \u4E2A\u6570\u636E\u5E93\u3001${legacy} \u6761\u65E7\u7248\u6D88\u606F`,
5693
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",
5694
5863
  schedule: "\u5B9A\u65F6\u540C\u6B65",
@@ -5738,7 +5907,7 @@ async function runDoctor(lang = "zh") {
5738
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 });
5739
5908
  }
5740
5909
  let g3 = s.groupTools, home = homedir19(), tools = [
5741
- { dirs: [join20(home, ".config", "claude", "projects"), join20(home, ".claude", "projects")], label: "Claude Code", exts: [".jsonl"] },
5910
+ { dirs: await discoverClaudeProjectDirs(), label: "Claude Code", exts: [".jsonl"] },
5742
5911
  { dirs: [join20(home, ".codex")], label: "Codex CLI", exts: [".jsonl"] },
5743
5912
  { dirs: [join20(home, "Library", "Application Support", "Cursor", "User", "globalStorage")], label: "Cursor", exts: [".vscdb"] },
5744
5913
  { dirs: [join20(home, ".copilot", "session-state"), join20(home, ".copilot", "otel")], label: "Copilot CLI", exts: [".jsonl"] },
@@ -5761,17 +5930,22 @@ async function runDoctor(lang = "zh") {
5761
5930
  { dirs: [resolveTraeNativeCacheDir(home), resolveTokscaleTraeCacheDir(home)], label: "Trae", exts: [".json"] }
5762
5931
  ];
5763
5932
  for (let tool of tools) {
5764
- let installed = !1, n = 0;
5933
+ let installed = !1, installedDirs = 0, n = 0;
5765
5934
  for (let dir of tool.dirs)
5766
5935
  try {
5767
- await stat5(dir), installed = !0, n += await countFiles(dir, tool.exts);
5936
+ await stat5(dir), installed = !0, installedDirs++, n += await countFiles(dir, tool.exts);
5768
5937
  } catch {
5769
5938
  }
5770
5939
  if (!installed) {
5771
5940
  checks.push({ group: g3, name: tool.label, status: "warn", message: s.notInstalled });
5772
5941
  continue;
5773
5942
  }
5774
- 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 });
5775
5949
  }
5776
5950
  let openCodeSources = await resolveOpenCodeSources({
5777
5951
  dbPaths: config.scanner?.opencodeDbPaths
@@ -6171,22 +6345,22 @@ var CACHE_DIR = join22(homedir21(), ".aiusage"), CACHE_PATH = join22(CACHE_DIR,
6171
6345
  "https://unpkg.com/@aiusage/pricing@latest/catalog.json"
6172
6346
  ];
6173
6347
  async function resolvePricingCatalog(config, options = {}) {
6174
- 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;
6175
6349
  if (!options.forceRefresh && cache && (mode === "manual" || mode === "offline" || isCacheFresh(cache, ttlHours)))
6176
- return fromCache(cache);
6350
+ return preferNewer(fromCache(cache));
6177
6351
  if ((mode !== "offline" || options.forceRefresh) && (mode === "auto" || options.forceRefresh)) {
6178
6352
  let candidates = getPricingUrls(config, options);
6179
6353
  for (let url of candidates)
6180
6354
  try {
6181
6355
  let catalog2 = await fetchPricingCatalog(url), fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
6182
- return await writePricingCache({ fetchedAt, sourceUrl: url, catalog: catalog2 }), {
6356
+ return await writePricingCache({ fetchedAt, sourceUrl: url, catalog: catalog2 }), preferNewer({
6183
6357
  catalog: catalog2,
6184
6358
  info: { source: "remote", version: catalog2.version, url, fetchedAt }
6185
- };
6359
+ });
6186
6360
  } catch {
6187
6361
  }
6188
6362
  }
6189
- return cache ? fromCache(cache) : {
6363
+ return cache ? preferNewer(fromCache(cache)) : {
6190
6364
  catalog,
6191
6365
  info: { source: "bundled", version: catalog.version }
6192
6366
  };
@@ -6216,6 +6390,9 @@ function getPricingUrls(config, options) {
6216
6390
  ].filter((url) => !!url);
6217
6391
  return [...new Set(urls.map((url) => url.trim()).filter(Boolean))];
6218
6392
  }
6393
+ function isOlderVersion(version, than) {
6394
+ return version.localeCompare(than) < 0;
6395
+ }
6219
6396
  function isCacheFresh(cache, ttlHours) {
6220
6397
  let fetched = new Date(cache.fetchedAt).getTime();
6221
6398
  return Number.isFinite(fetched) ? Date.now() - fetched < ttlHours * 60 * 60 * 1e3 : !1;
@@ -7171,8 +7348,8 @@ await (async () => {
7171
7348
  await runImport(parsed.flags, parsed.positionals);
7172
7349
  } else if (command === "setup")
7173
7350
  console.log(`To deploy the server, clone the repo and run the setup wizard:
7174
- `), console.log(" git clone https://github.com/ennann/aiusage.git"), console.log(" cd aiusage && pnpm install"), console.log(` pnpm setup
7175
- `), 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");
7176
7353
  else if (command === "--help" || command === "-h" || command === "help") {
7177
7354
  let zh2 = (await readConfig()).lang === "zh";
7178
7355
  printHelp(zh2);
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@aiusage/cli",
3
- "version": "1.7.10",
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,5 +1,5 @@
1
1
  {
2
- "version": "2026-07-26-claude-5-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
  },
@@ -7,6 +7,7 @@
7
7
  "claude-fibre-5": "claude-fable-5",
8
8
  "claude-fiber-5": "claude-fable-5",
9
9
  "claude-ops-5": "claude-opus-5",
10
+ "claude-opus-5.5": "claude-opus-5-5",
10
11
  "claude-opus-4-7-20260201": "claude-opus-4-7",
11
12
  "claude-sonnet-4-6-20250301": "claude-sonnet-4-6",
12
13
  "claude-opus-4-6-20250301": "claude-opus-4-6",
@@ -21,6 +22,15 @@
21
22
  "anthropic": {
22
23
  "claude-code": {
23
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
+ },
24
34
  "claude-fable-5": {
25
35
  "currency": "USD",
26
36
  "input_per_million": 10,
@@ -38,6 +48,15 @@
38
48
  "cache_write_1h_per_million": 20,
39
49
  "cached_input_per_million": 1
40
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
+ },
41
60
  "claude-opus-5": {
42
61
  "currency": "USD",
43
62
  "input_per_million": 5,
@@ -153,72 +172,141 @@
153
172
  "openai": {
154
173
  "codex": {
155
174
  "models": {
156
- "gpt-5.6-sol": {
175
+ "gpt-6-astra": {
157
176
  "currency": "USD",
158
177
  "notes": "prompts over 272K input tokens bill the full request at long-context rates",
159
- "input_per_million": 5,
160
- "cached_input_per_million": 0.5,
161
- "cache_write_per_million": 6.25,
162
- "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,
163
182
  "tiers": [
164
183
  {
165
184
  "threshold": 272000,
166
- "input_per_million": 5,
167
- "cached_input_per_million": 0.5,
168
- "cache_write_per_million": 6.25,
169
- "output_per_million": 30
170
- },
171
- {
172
185
  "input_per_million": 10,
173
186
  "cached_input_per_million": 1,
174
187
  "cache_write_per_million": 12.5,
175
- "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
176
195
  }
177
196
  ]
178
197
  },
179
- "gpt-5.6-terra": {
198
+ "gpt-6-sol": {
180
199
  "currency": "USD",
181
200
  "notes": "prompts over 272K input tokens bill the full request at long-context rates",
182
- "input_per_million": 2.5,
183
- "cached_input_per_million": 0.25,
184
- "cache_write_per_million": 3.125,
185
- "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,
186
205
  "tiers": [
187
206
  {
188
207
  "threshold": 272000,
189
- "input_per_million": 2.5,
190
- "cached_input_per_million": 0.25,
191
- "cache_write_per_million": 3.125,
192
- "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
193
212
  },
194
213
  {
195
- "input_per_million": 5,
196
- "cached_input_per_million": 0.5,
197
- "cache_write_per_million": 6.25,
198
- "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
199
218
  }
200
219
  ]
201
220
  },
202
- "gpt-5.6-luna": {
221
+ "gpt-6-luna": {
203
222
  "currency": "USD",
204
223
  "notes": "prompts over 272K input tokens bill the full request at long-context rates",
205
- "input_per_million": 1,
206
- "cached_input_per_million": 0.1,
207
- "cache_write_per_million": 1.25,
208
- "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,
209
228
  "tiers": [
210
229
  {
211
230
  "threshold": 272000,
212
- "input_per_million": 1,
213
- "cached_input_per_million": 0.1,
214
- "cache_write_per_million": 1.25,
215
- "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
235
+ },
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
216
258
  },
217
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,
218
277
  "input_per_million": 2,
219
278
  "cached_input_per_million": 0.2,
220
279
  "cache_write_per_million": 2.5,
221
- "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
222
310
  }
223
311
  ]
224
312
  },
@@ -1314,6 +1402,62 @@
1314
1402
  }
1315
1403
  }
1316
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
+ },
1317
1461
  "inflection": {
1318
1462
  "pi": {
1319
1463
  "models": {}