@chenlongapps/opencode-token-usage 0.4.2 → 0.4.3
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 +3 -3
- package/README.zh-CN.md +3 -3
- package/ROADMAP.md +10 -1
- package/dist/context-capture.d.ts +43 -0
- package/dist/context-capture.js +111 -0
- package/dist/controller.d.ts +4 -0
- package/dist/controller.js +43 -15
- package/dist/index.js +29 -8
- package/dist/performance.d.ts +9 -0
- package/dist/performance.js +61 -26
- package/dist/prices.generated.d.ts +128 -15
- package/dist/prices.generated.js +15 -10
- package/dist/pricing.d.ts +1 -1
- package/dist/source.d.ts +3 -2
- package/dist/source.js +31 -16
- package/dist/tui.js +209 -153
- package/dist/usage.d.ts +22 -2
- package/dist/usage.js +91 -14
- package/docs/pricing.md +1 -0
- package/docs/verification.md +30 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
2
|
-
readonly verified: "2026-09-
|
|
2
|
+
readonly verified: "2026-09-29";
|
|
3
3
|
readonly source: "https://models.dev/api.json";
|
|
4
4
|
readonly entries: readonly [{
|
|
5
5
|
readonly providerID: "ai21";
|
|
@@ -322,6 +322,17 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
322
322
|
readonly output: 3.6;
|
|
323
323
|
}];
|
|
324
324
|
readonly released: "2026-02-15";
|
|
325
|
+
}, {
|
|
326
|
+
readonly providerID: "alibaba";
|
|
327
|
+
readonly id: "qwen3.5-flash";
|
|
328
|
+
readonly prices: readonly [{
|
|
329
|
+
readonly input: 0.1;
|
|
330
|
+
readonly output: 0.4;
|
|
331
|
+
readonly cache: {
|
|
332
|
+
readonly read: 0.01;
|
|
333
|
+
};
|
|
334
|
+
}];
|
|
335
|
+
readonly released: "2026-02-23";
|
|
325
336
|
}, {
|
|
326
337
|
readonly providerID: "alibaba";
|
|
327
338
|
readonly id: "qwen3.5-plus";
|
|
@@ -387,6 +398,37 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
387
398
|
};
|
|
388
399
|
}];
|
|
389
400
|
readonly released: "2026-04-02";
|
|
401
|
+
}, {
|
|
402
|
+
readonly providerID: "alibaba";
|
|
403
|
+
readonly id: "qwen3.7-flash";
|
|
404
|
+
readonly prices: readonly [{
|
|
405
|
+
readonly input: 0.03;
|
|
406
|
+
readonly output: 0.13;
|
|
407
|
+
readonly cache: {
|
|
408
|
+
readonly read: 0.003;
|
|
409
|
+
};
|
|
410
|
+
}, {
|
|
411
|
+
readonly input: 0.1;
|
|
412
|
+
readonly output: 0.4;
|
|
413
|
+
readonly cache: {
|
|
414
|
+
readonly read: 0.01;
|
|
415
|
+
};
|
|
416
|
+
readonly tier: {
|
|
417
|
+
readonly type: "context";
|
|
418
|
+
readonly size: 32000;
|
|
419
|
+
};
|
|
420
|
+
}, {
|
|
421
|
+
readonly input: 0.2;
|
|
422
|
+
readonly output: 0.8;
|
|
423
|
+
readonly cache: {
|
|
424
|
+
readonly read: 0.02;
|
|
425
|
+
};
|
|
426
|
+
readonly tier: {
|
|
427
|
+
readonly type: "context";
|
|
428
|
+
readonly size: 256000;
|
|
429
|
+
};
|
|
430
|
+
}];
|
|
431
|
+
readonly released: "2026-07-15";
|
|
390
432
|
}, {
|
|
391
433
|
readonly providerID: "alibaba";
|
|
392
434
|
readonly id: "qwen3.7-max";
|
|
@@ -402,16 +444,16 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
402
444
|
readonly providerID: "alibaba";
|
|
403
445
|
readonly id: "qwen3.7-plus";
|
|
404
446
|
readonly prices: readonly [{
|
|
405
|
-
readonly input: 0.
|
|
406
|
-
readonly output:
|
|
447
|
+
readonly input: 0.4;
|
|
448
|
+
readonly output: 1.6;
|
|
407
449
|
readonly cache: {
|
|
408
|
-
readonly read: 0.
|
|
450
|
+
readonly read: 0.04;
|
|
409
451
|
};
|
|
410
452
|
}, {
|
|
411
|
-
readonly input: 2;
|
|
412
|
-
readonly output:
|
|
453
|
+
readonly input: 1.2;
|
|
454
|
+
readonly output: 4.8;
|
|
413
455
|
readonly cache: {
|
|
414
|
-
readonly read: 0.
|
|
456
|
+
readonly read: 0.12;
|
|
415
457
|
};
|
|
416
458
|
readonly tier: {
|
|
417
459
|
readonly type: "context";
|
|
@@ -441,6 +483,17 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
441
483
|
};
|
|
442
484
|
}];
|
|
443
485
|
readonly released: "2026-08-03";
|
|
486
|
+
}, {
|
|
487
|
+
readonly providerID: "alibaba";
|
|
488
|
+
readonly id: "qwen3.8-omni-flash";
|
|
489
|
+
readonly prices: readonly [{
|
|
490
|
+
readonly input: 0.15;
|
|
491
|
+
readonly output: 0.47;
|
|
492
|
+
readonly cache: {
|
|
493
|
+
readonly read: 0.016;
|
|
494
|
+
};
|
|
495
|
+
}];
|
|
496
|
+
readonly released: "2026-09-17";
|
|
444
497
|
}, {
|
|
445
498
|
readonly providerID: "alibaba";
|
|
446
499
|
readonly id: "qwq-plus";
|
|
@@ -668,6 +721,18 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
668
721
|
};
|
|
669
722
|
}];
|
|
670
723
|
readonly released: "2026-06-29";
|
|
724
|
+
}, {
|
|
725
|
+
readonly providerID: "anthropic";
|
|
726
|
+
readonly id: "claude-sonnet-5-5";
|
|
727
|
+
readonly prices: readonly [{
|
|
728
|
+
readonly input: 2;
|
|
729
|
+
readonly output: 10;
|
|
730
|
+
readonly cache: {
|
|
731
|
+
readonly read: 0.2;
|
|
732
|
+
readonly write: 2.5;
|
|
733
|
+
};
|
|
734
|
+
}];
|
|
735
|
+
readonly released: "2026-09-28";
|
|
671
736
|
}, {
|
|
672
737
|
readonly providerID: "arcee";
|
|
673
738
|
readonly id: "trinity-large-thinking";
|
|
@@ -1249,6 +1314,9 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1249
1314
|
readonly prices: readonly [{
|
|
1250
1315
|
readonly input: 0.3;
|
|
1251
1316
|
readonly output: 0.9;
|
|
1317
|
+
readonly cache: {
|
|
1318
|
+
readonly read: 0.03;
|
|
1319
|
+
};
|
|
1252
1320
|
}];
|
|
1253
1321
|
readonly released: "2024-05-29";
|
|
1254
1322
|
}, {
|
|
@@ -1315,14 +1383,6 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1315
1383
|
readonly output: 5;
|
|
1316
1384
|
}];
|
|
1317
1385
|
readonly released: "2025-03-17";
|
|
1318
|
-
}, {
|
|
1319
|
-
readonly providerID: "mistral";
|
|
1320
|
-
readonly id: "magistral-small";
|
|
1321
|
-
readonly prices: readonly [{
|
|
1322
|
-
readonly input: 0.5;
|
|
1323
|
-
readonly output: 1.5;
|
|
1324
|
-
}];
|
|
1325
|
-
readonly released: "2025-03-17";
|
|
1326
1386
|
}, {
|
|
1327
1387
|
readonly providerID: "mistral";
|
|
1328
1388
|
readonly id: "ministral-3b-latest";
|
|
@@ -1353,6 +1413,9 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1353
1413
|
readonly prices: readonly [{
|
|
1354
1414
|
readonly input: 0.5;
|
|
1355
1415
|
readonly output: 1.5;
|
|
1416
|
+
readonly cache: {
|
|
1417
|
+
readonly read: 0.05;
|
|
1418
|
+
};
|
|
1356
1419
|
}];
|
|
1357
1420
|
readonly released: "2024-11-01";
|
|
1358
1421
|
}, {
|
|
@@ -1361,6 +1424,9 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1361
1424
|
readonly prices: readonly [{
|
|
1362
1425
|
readonly input: 0.5;
|
|
1363
1426
|
readonly output: 1.5;
|
|
1427
|
+
readonly cache: {
|
|
1428
|
+
readonly read: 0.05;
|
|
1429
|
+
};
|
|
1364
1430
|
}];
|
|
1365
1431
|
readonly released: "2024-11-01";
|
|
1366
1432
|
}, {
|
|
@@ -1385,6 +1451,9 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1385
1451
|
readonly prices: readonly [{
|
|
1386
1452
|
readonly input: 1.5;
|
|
1387
1453
|
readonly output: 7.5;
|
|
1454
|
+
readonly cache: {
|
|
1455
|
+
readonly read: 0.15;
|
|
1456
|
+
};
|
|
1388
1457
|
}];
|
|
1389
1458
|
readonly released: "2026-04-29";
|
|
1390
1459
|
}, {
|
|
@@ -1393,6 +1462,9 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1393
1462
|
readonly prices: readonly [{
|
|
1394
1463
|
readonly input: 1.5;
|
|
1395
1464
|
readonly output: 7.5;
|
|
1465
|
+
readonly cache: {
|
|
1466
|
+
readonly read: 0.15;
|
|
1467
|
+
};
|
|
1396
1468
|
}];
|
|
1397
1469
|
readonly released: "2026-04-29";
|
|
1398
1470
|
}, {
|
|
@@ -1417,6 +1489,9 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1417
1489
|
readonly prices: readonly [{
|
|
1418
1490
|
readonly input: 0.15;
|
|
1419
1491
|
readonly output: 0.6;
|
|
1492
|
+
readonly cache: {
|
|
1493
|
+
readonly read: 0.015;
|
|
1494
|
+
};
|
|
1420
1495
|
}];
|
|
1421
1496
|
readonly released: "2026-03-16";
|
|
1422
1497
|
}, {
|
|
@@ -1425,6 +1500,9 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1425
1500
|
readonly prices: readonly [{
|
|
1426
1501
|
readonly input: 0.15;
|
|
1427
1502
|
readonly output: 0.6;
|
|
1503
|
+
readonly cache: {
|
|
1504
|
+
readonly read: 0.015;
|
|
1505
|
+
};
|
|
1428
1506
|
}];
|
|
1429
1507
|
readonly released: "2026-03-16";
|
|
1430
1508
|
}, {
|
|
@@ -2319,6 +2397,41 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
2319
2397
|
};
|
|
2320
2398
|
}];
|
|
2321
2399
|
readonly released: "2026-09-22";
|
|
2400
|
+
}, {
|
|
2401
|
+
readonly providerID: "openai";
|
|
2402
|
+
readonly id: "gpt-daybreak-blue-latest";
|
|
2403
|
+
readonly prices: readonly [{
|
|
2404
|
+
readonly input: 4;
|
|
2405
|
+
readonly output: 20;
|
|
2406
|
+
readonly cache: {
|
|
2407
|
+
readonly read: 0.4;
|
|
2408
|
+
readonly write: 5;
|
|
2409
|
+
};
|
|
2410
|
+
}, {
|
|
2411
|
+
readonly input: 8;
|
|
2412
|
+
readonly output: 30;
|
|
2413
|
+
readonly cache: {
|
|
2414
|
+
readonly read: 0.8;
|
|
2415
|
+
readonly write: 10;
|
|
2416
|
+
};
|
|
2417
|
+
readonly tier: {
|
|
2418
|
+
readonly type: "context";
|
|
2419
|
+
readonly size: 272000;
|
|
2420
|
+
};
|
|
2421
|
+
}];
|
|
2422
|
+
readonly released: "2026-08-07";
|
|
2423
|
+
}, {
|
|
2424
|
+
readonly providerID: "openai";
|
|
2425
|
+
readonly id: "gpt-daybreak-red-latest";
|
|
2426
|
+
readonly prices: readonly [{
|
|
2427
|
+
readonly input: 12.5;
|
|
2428
|
+
readonly output: 75;
|
|
2429
|
+
readonly cache: {
|
|
2430
|
+
readonly read: 1.25;
|
|
2431
|
+
readonly write: 15.625;
|
|
2432
|
+
};
|
|
2433
|
+
}];
|
|
2434
|
+
readonly released: "2026-08-07";
|
|
2322
2435
|
}, {
|
|
2323
2436
|
readonly providerID: "openai";
|
|
2324
2437
|
readonly id: "o1";
|
package/dist/prices.generated.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const GENERATED_PRICE_SNAPSHOT = {
|
|
2
|
-
verified: "2026-09-
|
|
2
|
+
verified: "2026-09-29",
|
|
3
3
|
source: "https://models.dev/api.json",
|
|
4
4
|
entries: [
|
|
5
5
|
{ "providerID": "ai21", "id": "jamba-large", "prices": [{ "input": 2, "output": 8 }], "released": "2025-07-01" },
|
|
@@ -40,16 +40,19 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
40
40
|
{ "providerID": "alibaba", "id": "qwen3.5-27b", "prices": [{ "input": 0.3, "output": 2.4 }], "released": "2026-02-23" },
|
|
41
41
|
{ "providerID": "alibaba", "id": "qwen3.5-35b-a3b", "prices": [{ "input": 0.25, "output": 2 }], "released": "2026-02-23" },
|
|
42
42
|
{ "providerID": "alibaba", "id": "qwen3.5-397b-a17b", "prices": [{ "input": 0.6, "output": 3.6 }], "released": "2026-02-15" },
|
|
43
|
+
{ "providerID": "alibaba", "id": "qwen3.5-flash", "prices": [{ "input": 0.1, "output": 0.4, "cache": { "read": 0.01 } }], "released": "2026-02-23" },
|
|
43
44
|
{ "providerID": "alibaba", "id": "qwen3.5-plus", "prices": [{ "input": 0.4, "output": 2.4 }], "released": "2026-02-16" },
|
|
44
45
|
{ "providerID": "alibaba", "id": "qwen3.6-27b", "prices": [{ "input": 0.6, "output": 3.6 }], "released": "2026-04-22" },
|
|
45
46
|
{ "providerID": "alibaba", "id": "qwen3.6-35b-a3b", "prices": [{ "input": 0.248, "output": 1.485 }], "released": "2026-04-17" },
|
|
46
47
|
{ "providerID": "alibaba", "id": "qwen3.6-flash", "prices": [{ "input": 0.1875, "output": 1.125, "cache": {} }], "released": "2026-04-27" },
|
|
47
48
|
{ "providerID": "alibaba", "id": "qwen3.6-max-preview", "prices": [{ "input": 1.3, "output": 7.8, "cache": { "read": 0.13 } }], "released": "2026-04-20" },
|
|
48
49
|
{ "providerID": "alibaba", "id": "qwen3.6-plus", "prices": [{ "input": 0.5, "output": 3, "cache": { "read": 0.05 } }, { "input": 2, "output": 6, "cache": { "read": 0.2 }, "tier": { "type": "context", "size": 256000 } }], "released": "2026-04-02" },
|
|
50
|
+
{ "providerID": "alibaba", "id": "qwen3.7-flash", "prices": [{ "input": 0.03, "output": 0.13, "cache": { "read": 0.003 } }, { "input": 0.1, "output": 0.4, "cache": { "read": 0.01 }, "tier": { "type": "context", "size": 32000 } }, { "input": 0.2, "output": 0.8, "cache": { "read": 0.02 }, "tier": { "type": "context", "size": 256000 } }], "released": "2026-07-15" },
|
|
49
51
|
{ "providerID": "alibaba", "id": "qwen3.7-max", "prices": [{ "input": 2.5, "output": 7.5, "cache": { "read": 0.5 } }], "released": "2026-05-21" },
|
|
50
|
-
{ "providerID": "alibaba", "id": "qwen3.7-plus", "prices": [{ "input": 0.
|
|
52
|
+
{ "providerID": "alibaba", "id": "qwen3.7-plus", "prices": [{ "input": 0.4, "output": 1.6, "cache": { "read": 0.04 } }, { "input": 1.2, "output": 4.8, "cache": { "read": 0.12 }, "tier": { "type": "context", "size": 256000 } }], "released": "2026-06-02" },
|
|
51
53
|
{ "providerID": "alibaba", "id": "qwen3.8-flash", "prices": [{ "input": 0.15, "output": 0.47, "cache": { "read": 0.016 } }], "released": "2026-08-26" },
|
|
52
54
|
{ "providerID": "alibaba", "id": "qwen3.8-max", "prices": [{ "input": 2, "output": 6, "cache": { "read": 0.25 } }], "released": "2026-08-03" },
|
|
55
|
+
{ "providerID": "alibaba", "id": "qwen3.8-omni-flash", "prices": [{ "input": 0.15, "output": 0.47, "cache": { "read": 0.016 } }], "released": "2026-09-17" },
|
|
53
56
|
{ "providerID": "alibaba", "id": "qwq-plus", "prices": [{ "input": 0.8, "output": 2.4 }], "released": "2025-03-05" },
|
|
54
57
|
{ "providerID": "anthropic", "id": "claude-fable-5", "prices": [{ "input": 10, "output": 50, "cache": { "read": 1, "write": 12.5 } }], "released": "2026-06-07" },
|
|
55
58
|
{ "providerID": "anthropic", "id": "claude-fable-5-1", "prices": [{ "input": 10, "output": 50, "cache": { "read": 0.25, "write": 12.5 } }], "released": "2026-09-01" },
|
|
@@ -69,6 +72,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
69
72
|
{ "providerID": "anthropic", "id": "claude-sonnet-4-5-20250929", "prices": [{ "input": 3, "output": 15, "cache": { "read": 0.3, "write": 3.75 } }], "released": "2025-09-29" },
|
|
70
73
|
{ "providerID": "anthropic", "id": "claude-sonnet-4-6", "prices": [{ "input": 3, "output": 15, "cache": { "read": 0.3, "write": 3.75 } }], "released": "2026-02-17" },
|
|
71
74
|
{ "providerID": "anthropic", "id": "claude-sonnet-5", "prices": [{ "input": 2, "output": 10, "cache": { "read": 0.2, "write": 2.5 } }], "released": "2026-06-29" },
|
|
75
|
+
{ "providerID": "anthropic", "id": "claude-sonnet-5-5", "prices": [{ "input": 2, "output": 10, "cache": { "read": 0.2, "write": 2.5 } }], "released": "2026-09-28" },
|
|
72
76
|
{ "providerID": "arcee", "id": "trinity-large-thinking", "prices": [{ "input": 0.25, "output": 0.8, "cache": { "read": 0.06 } }], "released": "2026-04-01" },
|
|
73
77
|
{ "providerID": "cohere", "id": "command-a-03-2025", "prices": [{ "input": 2.5, "output": 10 }], "released": "2025-03-13" },
|
|
74
78
|
{ "providerID": "cohere", "id": "command-a-plus-05-2026", "prices": [{ "input": 2.5, "output": 10 }], "released": "2026-05-20" },
|
|
@@ -118,7 +122,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
118
122
|
{ "providerID": "minimax", "id": "minimax-m2.7", "prices": [{ "input": 0.3, "output": 1.2, "cache": { "read": 0.06, "write": 0.375 } }], "released": "2026-03-18" },
|
|
119
123
|
{ "providerID": "minimax", "id": "minimax-m2.7-highspeed", "prices": [{ "input": 0.6, "output": 2.4, "cache": { "read": 0.06, "write": 0.375 } }], "released": "2026-03-18" },
|
|
120
124
|
{ "providerID": "minimax", "id": "minimax-m3", "prices": [{ "input": 0.3, "output": 1.2, "cache": { "read": 0.06 } }, { "input": 0.6, "output": 2.4, "cache": { "read": 0.12 }, "tier": { "type": "context", "size": 512000 } }], "released": "2026-06-01" },
|
|
121
|
-
{ "providerID": "mistral", "id": "codestral-latest", "prices": [{ "input": 0.3, "output": 0.9 }], "released": "2024-05-29" },
|
|
125
|
+
{ "providerID": "mistral", "id": "codestral-latest", "prices": [{ "input": 0.3, "output": 0.9, "cache": { "read": 0.03 } }], "released": "2024-05-29" },
|
|
122
126
|
{ "providerID": "mistral", "id": "devstral-2512", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-12-09" },
|
|
123
127
|
{ "providerID": "mistral", "id": "devstral-latest", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-12-09" },
|
|
124
128
|
{ "providerID": "mistral", "id": "devstral-medium-2507", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-07-10" },
|
|
@@ -127,20 +131,19 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
127
131
|
{ "providerID": "mistral", "id": "devstral-small-2507", "prices": [{ "input": 0.1, "output": 0.3 }], "released": "2025-07-10" },
|
|
128
132
|
{ "providerID": "mistral", "id": "labs-devstral-small-2512", "prices": [{ "input": 0, "output": 0 }], "released": "2025-12-09" },
|
|
129
133
|
{ "providerID": "mistral", "id": "magistral-medium-latest", "prices": [{ "input": 2, "output": 5 }], "released": "2025-03-17" },
|
|
130
|
-
{ "providerID": "mistral", "id": "magistral-small", "prices": [{ "input": 0.5, "output": 1.5 }], "released": "2025-03-17" },
|
|
131
134
|
{ "providerID": "mistral", "id": "ministral-3b-latest", "prices": [{ "input": 0.04, "output": 0.04 }], "released": "2024-10-01" },
|
|
132
135
|
{ "providerID": "mistral", "id": "ministral-8b-latest", "prices": [{ "input": 0.1, "output": 0.1 }], "released": "2024-10-01" },
|
|
133
136
|
{ "providerID": "mistral", "id": "mistral-large-2411", "prices": [{ "input": 2, "output": 6 }], "released": "2024-11-18" },
|
|
134
|
-
{ "providerID": "mistral", "id": "mistral-large-2512", "prices": [{ "input": 0.5, "output": 1.5 }], "released": "2024-11-01" },
|
|
135
|
-
{ "providerID": "mistral", "id": "mistral-large-latest", "prices": [{ "input": 0.5, "output": 1.5 }], "released": "2024-11-01" },
|
|
137
|
+
{ "providerID": "mistral", "id": "mistral-large-2512", "prices": [{ "input": 0.5, "output": 1.5, "cache": { "read": 0.05 } }], "released": "2024-11-01" },
|
|
138
|
+
{ "providerID": "mistral", "id": "mistral-large-latest", "prices": [{ "input": 0.5, "output": 1.5, "cache": { "read": 0.05 } }], "released": "2024-11-01" },
|
|
136
139
|
{ "providerID": "mistral", "id": "mistral-medium-2505", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-05-07" },
|
|
137
140
|
{ "providerID": "mistral", "id": "mistral-medium-2508", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-08-12" },
|
|
138
|
-
{ "providerID": "mistral", "id": "mistral-medium-2604", "prices": [{ "input": 1.5, "output": 7.5 }], "released": "2026-04-29" },
|
|
139
|
-
{ "providerID": "mistral", "id": "mistral-medium-latest", "prices": [{ "input": 1.5, "output": 7.5 }], "released": "2026-04-29" },
|
|
141
|
+
{ "providerID": "mistral", "id": "mistral-medium-2604", "prices": [{ "input": 1.5, "output": 7.5, "cache": { "read": 0.15 } }], "released": "2026-04-29" },
|
|
142
|
+
{ "providerID": "mistral", "id": "mistral-medium-latest", "prices": [{ "input": 1.5, "output": 7.5, "cache": { "read": 0.15 } }], "released": "2026-04-29" },
|
|
140
143
|
{ "providerID": "mistral", "id": "mistral-nemo", "prices": [{ "input": 0.15, "output": 0.15 }], "released": "2024-07-01" },
|
|
141
144
|
{ "providerID": "mistral", "id": "mistral-small-2506", "prices": [{ "input": 0.1, "output": 0.3 }], "released": "2025-06-20" },
|
|
142
|
-
{ "providerID": "mistral", "id": "mistral-small-2603", "prices": [{ "input": 0.15, "output": 0.6 }], "released": "2026-03-16" },
|
|
143
|
-
{ "providerID": "mistral", "id": "mistral-small-latest", "prices": [{ "input": 0.15, "output": 0.6 }], "released": "2026-03-16" },
|
|
145
|
+
{ "providerID": "mistral", "id": "mistral-small-2603", "prices": [{ "input": 0.15, "output": 0.6, "cache": { "read": 0.015 } }], "released": "2026-03-16" },
|
|
146
|
+
{ "providerID": "mistral", "id": "mistral-small-latest", "prices": [{ "input": 0.15, "output": 0.6, "cache": { "read": 0.015 } }], "released": "2026-03-16" },
|
|
144
147
|
{ "providerID": "mistral", "id": "open-mistral-7b", "prices": [{ "input": 0.25, "output": 0.25 }], "released": "2023-09-27" },
|
|
145
148
|
{ "providerID": "mistral", "id": "open-mistral-nemo", "prices": [{ "input": 0.15, "output": 0.15 }], "released": "2024-07-01" },
|
|
146
149
|
{ "providerID": "mistral", "id": "open-mixtral-8x22b", "prices": [{ "input": 2, "output": 6 }], "released": "2024-04-17" },
|
|
@@ -214,6 +217,8 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
214
217
|
{ "providerID": "openai", "id": "gpt-6-luna-fast", "providers": ["openai"], "prices": [{ "input": 0.2, "output": 1, "cache": { "read": 0.02, "write": 0.25 } }, { "tier": { "type": "context", "size": 272000 } }], "released": "2026-09-22" },
|
|
215
218
|
{ "providerID": "openai", "id": "gpt-6-sol", "prices": [{ "input": 2, "output": 10, "cache": { "read": 0.2, "write": 2.5 } }, { "input": 4, "output": 15, "cache": { "read": 0.4, "write": 5 }, "tier": { "type": "context", "size": 272000 } }], "released": "2026-09-22" },
|
|
216
219
|
{ "providerID": "openai", "id": "gpt-6-sol-fast", "providers": ["openai"], "prices": [{ "input": 4, "output": 20, "cache": { "read": 0.4, "write": 5 } }, { "tier": { "type": "context", "size": 272000 } }], "released": "2026-09-22" },
|
|
220
|
+
{ "providerID": "openai", "id": "gpt-daybreak-blue-latest", "prices": [{ "input": 4, "output": 20, "cache": { "read": 0.4, "write": 5 } }, { "input": 8, "output": 30, "cache": { "read": 0.8, "write": 10 }, "tier": { "type": "context", "size": 272000 } }], "released": "2026-08-07" },
|
|
221
|
+
{ "providerID": "openai", "id": "gpt-daybreak-red-latest", "prices": [{ "input": 12.5, "output": 75, "cache": { "read": 1.25, "write": 15.625 } }], "released": "2026-08-07" },
|
|
217
222
|
{ "providerID": "openai", "id": "o1", "prices": [{ "input": 15, "output": 60, "cache": { "read": 7.5 } }], "released": "2024-12-05" },
|
|
218
223
|
{ "providerID": "openai", "id": "o1-pro", "prices": [{ "input": 150, "output": 600 }], "released": "2025-03-19" },
|
|
219
224
|
{ "providerID": "openai", "id": "o3", "prices": [{ "input": 2, "output": 8, "cache": { "read": 0.5 } }], "released": "2025-04-16" },
|
package/dist/pricing.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface OfficialPriceEntry {
|
|
|
14
14
|
/** Checked-in data: updating prices is explicit, not a network request at
|
|
15
15
|
* startup, during a refresh, or during an npm build. */
|
|
16
16
|
export declare const OFFICIAL_PRICE_SNAPSHOT: {
|
|
17
|
-
verified: "2026-09-
|
|
17
|
+
verified: "2026-09-29";
|
|
18
18
|
source: "https://models.dev/api.json";
|
|
19
19
|
entries: OfficialPriceEntry[];
|
|
20
20
|
};
|
package/dist/source.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { OpenCodeClient, SessionInfo } from "@opencode/client";
|
|
2
2
|
import type { ContextSources } from "./context-sources.js";
|
|
3
3
|
import type { PriceCatalog, UsageMessage } from "./usage.js";
|
|
4
|
-
export type Session = Pick<SessionInfo, "id" | "parentID" | "fork" | "model" | "location" | "title">;
|
|
4
|
+
export type Session = Pick<SessionInfo, "id" | "parentID" | "fork" | "model" | "location" | "title" | "revert">;
|
|
5
5
|
export interface Page<T> {
|
|
6
6
|
data: T[];
|
|
7
7
|
cursor: {
|
|
@@ -31,7 +31,8 @@ export interface Snapshot {
|
|
|
31
31
|
messages: Map<string, Map<string, UsageMessage>>;
|
|
32
32
|
model: ActiveModel;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
/** A changed set permits reuse of unchanged histories. Omitting it forces a full read. */
|
|
35
|
+
export declare function loadSnapshot(source: UsageSource, sessionID: string, signal: AbortSignal, previous?: Snapshot, changed?: ReadonlySet<string>): Promise<Snapshot>;
|
|
35
36
|
/** History of the viewed session only, in API order (`order: "asc"`). */
|
|
36
37
|
export declare function viewedMessages(snapshot: Snapshot): readonly UsageMessage[];
|
|
37
38
|
export declare function uniqueMessages(snapshot: Snapshot): Iterable<UsageMessage>;
|
package/dist/source.js
CHANGED
|
@@ -48,7 +48,8 @@ export async function pages(read, signal) {
|
|
|
48
48
|
} while (cursor);
|
|
49
49
|
return result;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
/** A changed set permits reuse of unchanged histories. Omitting it forces a full read. */
|
|
52
|
+
export async function loadSnapshot(source, sessionID, signal, previous, changed) {
|
|
52
53
|
const viewed = await source.session(sessionID, signal);
|
|
53
54
|
let root = viewed;
|
|
54
55
|
const ancestors = new Set();
|
|
@@ -61,26 +62,40 @@ export async function loadSnapshot(source, sessionID, signal) {
|
|
|
61
62
|
}
|
|
62
63
|
const sessions = new Map([[root.id, root]]);
|
|
63
64
|
const messages = new Map();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
65
|
+
const cache = previous?.rootID === root.id && previous.viewedID === viewed.id && changed
|
|
66
|
+
? previous.messages : undefined;
|
|
67
|
+
// Traverse every branch so additions and removals replace the tree atomically. Each
|
|
68
|
+
// wave reads at most four sessions concurrently; pagination within one stays ordered.
|
|
69
|
+
let frontier = [root];
|
|
70
|
+
while (frontier.length) {
|
|
71
|
+
const next = [];
|
|
72
|
+
for (let offset = 0; offset < frontier.length; offset += 4) {
|
|
73
|
+
signal.throwIfAborted();
|
|
74
|
+
const batch = frontier.slice(offset, offset + 4);
|
|
75
|
+
const results = await Promise.all(batch.map(async (session) => {
|
|
76
|
+
const reused = !changed?.has(session.id) ? cache?.get(session.id) : undefined;
|
|
77
|
+
const children = await pages(cursor => source.children(session.id, cursor, signal), signal);
|
|
78
|
+
const history = reused ?? new Map((await pages(cursor => source.messages(session.id, cursor, signal), signal))
|
|
79
|
+
.map(message => [message.id, message]));
|
|
80
|
+
return { session, children, history };
|
|
81
|
+
}));
|
|
82
|
+
for (const { session, children, history } of results) {
|
|
83
|
+
messages.set(session.id, history);
|
|
84
|
+
for (const child of children) {
|
|
85
|
+
if (child.parentID !== session.id)
|
|
86
|
+
throw new Error("Unexpected child session");
|
|
87
|
+
if (!sessions.has(child.id)) {
|
|
88
|
+
sessions.set(child.id, child);
|
|
89
|
+
next.push(child);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
79
92
|
}
|
|
80
93
|
}
|
|
94
|
+
frontier = next;
|
|
81
95
|
}
|
|
82
96
|
if (!sessions.has(viewed.id))
|
|
83
97
|
throw new Error("Session tree changed during refresh");
|
|
98
|
+
sessions.set(viewed.id, viewed);
|
|
84
99
|
const model = await source.model(viewed, signal);
|
|
85
100
|
signal.throwIfAborted();
|
|
86
101
|
return { rootID: root.id, viewedID: viewed.id, sessions, messages, model };
|