@chenlongapps/opencode-token-usage 0.4.5 → 0.4.6
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 -1
- package/README.zh-CN.md +3 -1
- package/dist/context-sources.js +4 -1
- package/dist/prices.generated.d.ts +81 -5
- package/dist/prices.generated.js +11 -5
- package/dist/pricing.d.ts +1 -1
- package/docs/verification.md +28 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Alternatively, add the package to your project's `opencode.json` or `opencode.js
|
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
> [!NOTE]
|
|
37
|
-
> Requires Node.js 22
|
|
37
|
+
> Requires Node.js 22+ (see the OpenTUI engine note under [Development](#development)). OpenCode 2.0.9 and 2.0.10 have been verified in earlier releases. The current SDK 2.0.24 build has been verified on OpenCode 2.0.11, 2.0.22, and 2.0.24.
|
|
38
38
|
|
|
39
39
|
Restart OpenCode after installation. The panel appears in the native sidebar when `session.sidebar` is set to `auto` and the terminal is wide enough. OpenCode hides the sidebar in subagent views, so the plugin keeps one live summary line above the composer with Context, Total, Cost, and TPS. Click the line to open the full statistics in a centered dialog. Press Escape or click **esc** to close it; closing the dialog does not interrupt the subagent.
|
|
40
40
|
|
|
@@ -99,6 +99,8 @@ npm run build
|
|
|
99
99
|
npm run test:smoke
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
The OpenCode SDK packages are pinned to `2.0.24`, with OpenTUI `0.5.14`. Clean installation, typecheck, tests, build, and real-host smoke have passed on Node.js 22. OpenTUI declares Node.js `>=26.4.0` for its native Node runtime, so npm reports `EBADENGINE` on Node 22; `engine-strict` installations require a Node version meeting that dependency's engine requirement. The plugin's TUI runs inside OpenCode, not as a standalone Node 22 renderer. This upgrade keeps the project's Node.js 22+ minimum unchanged.
|
|
103
|
+
|
|
102
104
|
The [price update workflow](.github/workflows/update-prices.yml) checks models.dev every day at 22:00 UTC (or on demand via **Run workflow** on `main`). No snapshot diff means no release. Changes within the reviewed first-party source allowlist pass typecheck, tests, build, and pack validation, then automatically bump the patch version (for example, `0.4.4` → `0.4.5`), commit only `src/prices.generated.ts`, `package.json`, and `package-lock.json`, and atomically push `main` and its version tag. The workflow creates a GitHub Release and explicitly dispatches [`publish.yml`](.github/workflows/publish.yml) on that tag to publish via npm Trusted Publishing/OIDC; no long-lived npm token is needed. GitHub Actions must be allowed to push to `main` and create tags, and npm must trust `publish.yml` with permission to run `npm publish`.
|
|
103
105
|
|
|
104
106
|
Failed validation never bumps the version. An unfinished tagged price release is retried with the same version before checking new prices; registry outages are not treated as missing versions. Publishing skips versions already on npm, prevents moving `latest` backwards, and verifies registry visibility after publication. Manufacturer/source allowlist additions, aliases, and manually verified price exceptions still require human review. See the [release guide](docs/releasing.md) for setup and retries.
|
package/README.zh-CN.md
CHANGED
|
@@ -34,7 +34,7 @@ opencode plugin add @chenlongapps/opencode-token-usage
|
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
> [!NOTE]
|
|
37
|
-
> 需要 Node.js 22
|
|
37
|
+
> 需要 Node.js 22+(见[开发](#开发)中的 OpenTUI 引擎说明)。此前发布已验证 OpenCode 2.0.9 和 2.0.10;当前 SDK 2.0.24 构建已在 OpenCode 2.0.11、2.0.22 和 2.0.24 上验证。
|
|
38
38
|
|
|
39
39
|
安装后重启 OpenCode。终端足够宽且 `session.sidebar` 设为 `auto` 时,面板会显示在原生侧边栏中。OpenCode 在子代理视图中隐藏侧边栏,因此插件会在输入区上方保留一行实时摘要,显示 Context、Total、Cost 和 TPS。点击摘要可在居中弹窗中查看完整统计;按 Escape 或点击 **esc** 即可关闭,关闭弹窗不会中断子代理。
|
|
40
40
|
|
|
@@ -99,6 +99,8 @@ npm run build
|
|
|
99
99
|
npm run test:smoke
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
OpenCode SDK 包精确锁定为 `2.0.24`,OpenTUI 为 `0.5.14`。Node.js 22 下已通过干净安装、类型检查、测试、构建和真实宿主 smoke。OpenTUI 为其原生 Node 运行时声明 Node.js `>=26.4.0`,因此 Node 22 安装时 npm 会输出 `EBADENGINE`;启用 `engine-strict` 时须使用满足该依赖引擎要求的 Node 版本。插件的 TUI 在 OpenCode 内运行,并非独立的 Node 22 渲染器。本次升级保持项目 Node.js 22+ 的最低要求不变。
|
|
103
|
+
|
|
102
104
|
[价格更新工作流](.github/workflows/update-prices.yml) 每天 UTC 22:00 检查 models.dev,也可在 `main` 上通过 **Run workflow** 手动触发。快照无变化就不发布。经审核的原厂来源白名单内有变化时,先通过类型检查、测试、构建和打包检查,再自动升级 patch 版本(例如 `0.4.4` → `0.4.5`),只提交 `src/prices.generated.ts`、`package.json` 和 `package-lock.json`,并原子推送 `main` 与版本标签。工作流创建 GitHub Release,显式触发该标签上的 [`publish.yml`](.github/workflows/publish.yml),通过 npm Trusted Publishing/OIDC 发布,无需长期 npm token。仓库必须允许 GitHub Actions 推送 `main` 和创建标签;npm 必须信任 `publish.yml` 并允许执行 `npm publish`。
|
|
103
105
|
|
|
104
106
|
验证失败不会升版本。已打标签但未完成的自动价格发布会优先重试同一版本,再检查新价格;registry 故障不会被当作版本不存在。发布时跳过 npm 已有版本、防止 `latest` 倒退,并在发布后核验 registry 中的版本。新增原厂/来源白名单、别名及人工核实的价格例外仍需人工审核。配置和重试方法见[发布说明](docs/releasing.md)。
|
package/dist/context-sources.js
CHANGED
|
@@ -57,7 +57,10 @@ export function estimateContextSources(request, mcpServers = [], capturedAt = Da
|
|
|
57
57
|
}
|
|
58
58
|
if (part.type === "media") {
|
|
59
59
|
// Media payload sizes do not translate to provider token counts.
|
|
60
|
-
|
|
60
|
+
// Older hosts expose mediaType directly; SDK 2.0.24 wraps it in an asset.
|
|
61
|
+
const mediaType = part.media?.mediaType
|
|
62
|
+
?? ("mediaType" in part && typeof part.mediaType === "string" ? part.mediaType : "");
|
|
63
|
+
tokens.Other += estimate(part.filename ?? mediaType);
|
|
61
64
|
continue;
|
|
62
65
|
}
|
|
63
66
|
if (part.type === "tool-call") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
2
|
-
readonly verified: "2026-10-
|
|
2
|
+
readonly verified: "2026-10-08";
|
|
3
3
|
readonly source: "https://models.dev/api.json";
|
|
4
4
|
readonly entries: readonly [{
|
|
5
5
|
readonly providerID: "ai21";
|
|
@@ -92,8 +92,8 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
92
92
|
readonly providerID: "alibaba";
|
|
93
93
|
readonly id: "qwen-vl-ocr";
|
|
94
94
|
readonly prices: readonly [{
|
|
95
|
-
readonly input: 0.
|
|
96
|
-
readonly output: 0.
|
|
95
|
+
readonly input: 0.07;
|
|
96
|
+
readonly output: 0.16;
|
|
97
97
|
}];
|
|
98
98
|
readonly released: "2024-10-28";
|
|
99
99
|
}, {
|
|
@@ -550,6 +550,29 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
550
550
|
};
|
|
551
551
|
}];
|
|
552
552
|
readonly released: "2025-10-15";
|
|
553
|
+
}, {
|
|
554
|
+
readonly providerID: "anthropic";
|
|
555
|
+
readonly id: "claude-haiku-5-5";
|
|
556
|
+
readonly prices: readonly [{
|
|
557
|
+
readonly input: 0.1;
|
|
558
|
+
readonly output: 0.5;
|
|
559
|
+
readonly cache: {
|
|
560
|
+
readonly read: 0.01;
|
|
561
|
+
readonly write: 0.125;
|
|
562
|
+
};
|
|
563
|
+
}, {
|
|
564
|
+
readonly input: 0.5;
|
|
565
|
+
readonly output: 2.5;
|
|
566
|
+
readonly cache: {
|
|
567
|
+
readonly read: 0.05;
|
|
568
|
+
readonly write: 0.625;
|
|
569
|
+
};
|
|
570
|
+
readonly tier: {
|
|
571
|
+
readonly type: "context";
|
|
572
|
+
readonly size: 100000;
|
|
573
|
+
};
|
|
574
|
+
}];
|
|
575
|
+
readonly released: "2026-10-07";
|
|
553
576
|
}, {
|
|
554
577
|
readonly providerID: "anthropic";
|
|
555
578
|
readonly id: "claude-opus-4-5";
|
|
@@ -728,7 +751,7 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
728
751
|
readonly input: 2;
|
|
729
752
|
readonly output: 10;
|
|
730
753
|
readonly cache: {
|
|
731
|
-
readonly read: 0.
|
|
754
|
+
readonly read: 0.1;
|
|
732
755
|
readonly write: 2.5;
|
|
733
756
|
};
|
|
734
757
|
}];
|
|
@@ -1266,7 +1289,7 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1266
1289
|
readonly input: 0.6;
|
|
1267
1290
|
readonly output: 2.4;
|
|
1268
1291
|
readonly cache: {
|
|
1269
|
-
readonly read: 0.
|
|
1292
|
+
readonly read: 0.03;
|
|
1270
1293
|
readonly write: 0.375;
|
|
1271
1294
|
};
|
|
1272
1295
|
}];
|
|
@@ -1316,6 +1339,17 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1316
1339
|
};
|
|
1317
1340
|
}];
|
|
1318
1341
|
readonly released: "2026-06-01";
|
|
1342
|
+
}, {
|
|
1343
|
+
readonly providerID: "mistral";
|
|
1344
|
+
readonly id: "codestral-2508";
|
|
1345
|
+
readonly prices: readonly [{
|
|
1346
|
+
readonly input: 0.3;
|
|
1347
|
+
readonly output: 0.9;
|
|
1348
|
+
readonly cache: {
|
|
1349
|
+
readonly read: 0.03;
|
|
1350
|
+
};
|
|
1351
|
+
}];
|
|
1352
|
+
readonly released: "2025-07-30";
|
|
1319
1353
|
}, {
|
|
1320
1354
|
readonly providerID: "mistral";
|
|
1321
1355
|
readonly id: "codestral-latest";
|
|
@@ -1391,6 +1425,28 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1391
1425
|
readonly output: 5;
|
|
1392
1426
|
}];
|
|
1393
1427
|
readonly released: "2025-03-17";
|
|
1428
|
+
}, {
|
|
1429
|
+
readonly providerID: "mistral";
|
|
1430
|
+
readonly id: "ministral-14b-2512";
|
|
1431
|
+
readonly prices: readonly [{
|
|
1432
|
+
readonly input: 0.2;
|
|
1433
|
+
readonly output: 0.2;
|
|
1434
|
+
readonly cache: {
|
|
1435
|
+
readonly read: 0.02;
|
|
1436
|
+
};
|
|
1437
|
+
}];
|
|
1438
|
+
readonly released: "2025-12-02";
|
|
1439
|
+
}, {
|
|
1440
|
+
readonly providerID: "mistral";
|
|
1441
|
+
readonly id: "ministral-3b-2512";
|
|
1442
|
+
readonly prices: readonly [{
|
|
1443
|
+
readonly input: 0.1;
|
|
1444
|
+
readonly output: 0.1;
|
|
1445
|
+
readonly cache: {
|
|
1446
|
+
readonly read: 0.01;
|
|
1447
|
+
};
|
|
1448
|
+
}];
|
|
1449
|
+
readonly released: "2025-12-02";
|
|
1394
1450
|
}, {
|
|
1395
1451
|
readonly providerID: "mistral";
|
|
1396
1452
|
readonly id: "ministral-3b-latest";
|
|
@@ -1399,6 +1455,17 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1399
1455
|
readonly output: 0.04;
|
|
1400
1456
|
}];
|
|
1401
1457
|
readonly released: "2024-10-01";
|
|
1458
|
+
}, {
|
|
1459
|
+
readonly providerID: "mistral";
|
|
1460
|
+
readonly id: "ministral-8b-2512";
|
|
1461
|
+
readonly prices: readonly [{
|
|
1462
|
+
readonly input: 0.15;
|
|
1463
|
+
readonly output: 0.15;
|
|
1464
|
+
readonly cache: {
|
|
1465
|
+
readonly read: 0.015;
|
|
1466
|
+
};
|
|
1467
|
+
}];
|
|
1468
|
+
readonly released: "2025-12-02";
|
|
1402
1469
|
}, {
|
|
1403
1470
|
readonly providerID: "mistral";
|
|
1404
1471
|
readonly id: "ministral-8b-latest";
|
|
@@ -1572,6 +1639,14 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1572
1639
|
readonly output: 6;
|
|
1573
1640
|
}];
|
|
1574
1641
|
readonly released: "2024-11-01";
|
|
1642
|
+
}, {
|
|
1643
|
+
readonly providerID: "mistral";
|
|
1644
|
+
readonly id: "voxtral-small-2507";
|
|
1645
|
+
readonly prices: readonly [{
|
|
1646
|
+
readonly input: 0.1;
|
|
1647
|
+
readonly output: 0.4;
|
|
1648
|
+
}];
|
|
1649
|
+
readonly released: "2025-07-15";
|
|
1575
1650
|
}, {
|
|
1576
1651
|
readonly providerID: "mistral";
|
|
1577
1652
|
readonly id: "voxtral-small-latest";
|
|
@@ -1621,6 +1696,7 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1621
1696
|
readonly output: 15;
|
|
1622
1697
|
readonly cache: {
|
|
1623
1698
|
readonly read: 0.3;
|
|
1699
|
+
readonly write: 3;
|
|
1624
1700
|
};
|
|
1625
1701
|
}];
|
|
1626
1702
|
readonly released: "2026-07-16";
|
package/dist/prices.generated.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const GENERATED_PRICE_SNAPSHOT = {
|
|
2
|
-
verified: "2026-10-
|
|
2
|
+
verified: "2026-10-08",
|
|
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" },
|
|
@@ -13,7 +13,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
13
13
|
{ "providerID": "alibaba", "id": "qwen-plus-character-ja", "prices": [{ "input": 0.5, "output": 1.4 }] },
|
|
14
14
|
{ "providerID": "alibaba", "id": "qwen-turbo", "prices": [{ "input": 0.05, "output": 0.2, "reasoning": 0.5 }], "released": "2024-11-01" },
|
|
15
15
|
{ "providerID": "alibaba", "id": "qwen-vl-max", "prices": [{ "input": 0.8, "output": 3.2 }], "released": "2024-04-08" },
|
|
16
|
-
{ "providerID": "alibaba", "id": "qwen-vl-ocr", "prices": [{ "input": 0.
|
|
16
|
+
{ "providerID": "alibaba", "id": "qwen-vl-ocr", "prices": [{ "input": 0.07, "output": 0.16 }], "released": "2024-10-28" },
|
|
17
17
|
{ "providerID": "alibaba", "id": "qwen-vl-plus", "prices": [{ "input": 0.21, "output": 0.63 }], "released": "2024-01-25" },
|
|
18
18
|
{ "providerID": "alibaba", "id": "qwen2-5-14b-instruct", "prices": [{ "input": 0.35, "output": 1.4 }] },
|
|
19
19
|
{ "providerID": "alibaba", "id": "qwen2-5-32b-instruct", "prices": [{ "input": 0.7, "output": 2.8 }] },
|
|
@@ -58,6 +58,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
58
58
|
{ "providerID": "anthropic", "id": "claude-fable-5-1", "prices": [{ "input": 10, "output": 50, "cache": { "read": 0.25, "write": 12.5 } }], "released": "2026-09-01" },
|
|
59
59
|
{ "providerID": "anthropic", "id": "claude-haiku-4-5", "prices": [{ "input": 1, "output": 5, "cache": { "read": 0.1, "write": 1.25 } }], "released": "2025-10-15" },
|
|
60
60
|
{ "providerID": "anthropic", "id": "claude-haiku-4-5-20251001", "prices": [{ "input": 1, "output": 5, "cache": { "read": 0.1, "write": 1.25 } }], "released": "2025-10-15" },
|
|
61
|
+
{ "providerID": "anthropic", "id": "claude-haiku-5-5", "prices": [{ "input": 0.1, "output": 0.5, "cache": { "read": 0.01, "write": 0.125 } }, { "input": 0.5, "output": 2.5, "cache": { "read": 0.05, "write": 0.625 }, "tier": { "type": "context", "size": 100000 } }], "released": "2026-10-07" },
|
|
61
62
|
{ "providerID": "anthropic", "id": "claude-opus-4-5", "prices": [{ "input": 5, "output": 25, "cache": { "read": 0.5, "write": 6.25 } }], "released": "2025-11-24" },
|
|
62
63
|
{ "providerID": "anthropic", "id": "claude-opus-4-5-20251101", "prices": [{ "input": 5, "output": 25, "cache": { "read": 0.5, "write": 6.25 } }], "released": "2025-11-24" },
|
|
63
64
|
{ "providerID": "anthropic", "id": "claude-opus-4-6", "prices": [{ "input": 5, "output": 25, "cache": { "read": 0.5, "write": 6.25 } }], "released": "2026-02-04" },
|
|
@@ -72,7 +73,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
72
73
|
{ "providerID": "anthropic", "id": "claude-sonnet-4-5-20250929", "prices": [{ "input": 3, "output": 15, "cache": { "read": 0.3, "write": 3.75 } }], "released": "2025-09-29" },
|
|
73
74
|
{ "providerID": "anthropic", "id": "claude-sonnet-4-6", "prices": [{ "input": 3, "output": 15, "cache": { "read": 0.3, "write": 3.75 } }], "released": "2026-02-17" },
|
|
74
75
|
{ "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.
|
|
76
|
+
{ "providerID": "anthropic", "id": "claude-sonnet-5-5", "prices": [{ "input": 2, "output": 10, "cache": { "read": 0.1, "write": 2.5 } }], "released": "2026-09-28" },
|
|
76
77
|
{ "providerID": "arcee", "id": "trinity-large-thinking", "prices": [{ "input": 0.25, "output": 0.8, "cache": { "read": 0.06 } }], "released": "2026-04-01" },
|
|
77
78
|
{ "providerID": "cohere", "id": "command-a-03-2025", "prices": [{ "input": 2.5, "output": 10 }], "released": "2025-03-13" },
|
|
78
79
|
{ "providerID": "cohere", "id": "command-a-plus-05-2026", "prices": [{ "input": 2.5, "output": 10 }], "released": "2026-05-20" },
|
|
@@ -119,10 +120,11 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
119
120
|
{ "providerID": "minimax", "id": "minimax-m2", "prices": [{ "input": 0.3, "output": 1.2 }], "released": "2025-10-27" },
|
|
120
121
|
{ "providerID": "minimax", "id": "minimax-m2.1", "prices": [{ "input": 0.3, "output": 1.2, "cache": { "read": 0.03, "write": 0.375 } }], "released": "2025-12-23" },
|
|
121
122
|
{ "providerID": "minimax", "id": "minimax-m2.5", "prices": [{ "input": 0.3, "output": 1.2, "cache": { "read": 0.03, "write": 0.375 } }], "released": "2026-02-12" },
|
|
122
|
-
{ "providerID": "minimax", "id": "minimax-m2.5-highspeed", "prices": [{ "input": 0.6, "output": 2.4, "cache": { "read": 0.
|
|
123
|
+
{ "providerID": "minimax", "id": "minimax-m2.5-highspeed", "prices": [{ "input": 0.6, "output": 2.4, "cache": { "read": 0.03, "write": 0.375 } }], "released": "2026-02-13" },
|
|
123
124
|
{ "providerID": "minimax", "id": "minimax-m2.7", "prices": [{ "input": 0.3, "output": 1.2, "cache": { "read": 0.06, "write": 0.375 } }], "released": "2026-03-18" },
|
|
124
125
|
{ "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" },
|
|
125
126
|
{ "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" },
|
|
127
|
+
{ "providerID": "mistral", "id": "codestral-2508", "prices": [{ "input": 0.3, "output": 0.9, "cache": { "read": 0.03 } }], "released": "2025-07-30" },
|
|
126
128
|
{ "providerID": "mistral", "id": "codestral-latest", "prices": [{ "input": 0.3, "output": 0.9, "cache": { "read": 0.03 } }], "released": "2024-05-29" },
|
|
127
129
|
{ "providerID": "mistral", "id": "devstral-2512", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-12-09" },
|
|
128
130
|
{ "providerID": "mistral", "id": "devstral-latest", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-12-09" },
|
|
@@ -132,7 +134,10 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
132
134
|
{ "providerID": "mistral", "id": "devstral-small-2507", "prices": [{ "input": 0.1, "output": 0.3 }], "released": "2025-07-10" },
|
|
133
135
|
{ "providerID": "mistral", "id": "labs-devstral-small-2512", "prices": [{ "input": 0, "output": 0 }], "released": "2025-12-09" },
|
|
134
136
|
{ "providerID": "mistral", "id": "magistral-medium-latest", "prices": [{ "input": 2, "output": 5 }], "released": "2025-03-17" },
|
|
137
|
+
{ "providerID": "mistral", "id": "ministral-14b-2512", "prices": [{ "input": 0.2, "output": 0.2, "cache": { "read": 0.02 } }], "released": "2025-12-02" },
|
|
138
|
+
{ "providerID": "mistral", "id": "ministral-3b-2512", "prices": [{ "input": 0.1, "output": 0.1, "cache": { "read": 0.01 } }], "released": "2025-12-02" },
|
|
135
139
|
{ "providerID": "mistral", "id": "ministral-3b-latest", "prices": [{ "input": 0.04, "output": 0.04 }], "released": "2024-10-01" },
|
|
140
|
+
{ "providerID": "mistral", "id": "ministral-8b-2512", "prices": [{ "input": 0.15, "output": 0.15, "cache": { "read": 0.015 } }], "released": "2025-12-02" },
|
|
136
141
|
{ "providerID": "mistral", "id": "ministral-8b-latest", "prices": [{ "input": 0.1, "output": 0.1 }], "released": "2024-10-01" },
|
|
137
142
|
{ "providerID": "mistral", "id": "mistral-large-2411", "prices": [{ "input": 2, "output": 6 }], "released": "2024-11-18" },
|
|
138
143
|
{ "providerID": "mistral", "id": "mistral-large-2512", "prices": [{ "input": 0.5, "output": 1.5, "cache": { "read": 0.05 } }], "released": "2024-11-01" },
|
|
@@ -152,11 +157,12 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
152
157
|
{ "providerID": "mistral", "id": "open-mixtral-8x7b", "prices": [{ "input": 0.7, "output": 0.7 }], "released": "2023-12-11" },
|
|
153
158
|
{ "providerID": "mistral", "id": "pixtral-12b", "prices": [{ "input": 0.15, "output": 0.15 }], "released": "2024-09-01" },
|
|
154
159
|
{ "providerID": "mistral", "id": "pixtral-large-latest", "prices": [{ "input": 2, "output": 6 }], "released": "2024-11-01" },
|
|
160
|
+
{ "providerID": "mistral", "id": "voxtral-small-2507", "prices": [{ "input": 0.1, "output": 0.4 }], "released": "2025-07-15" },
|
|
155
161
|
{ "providerID": "mistral", "id": "voxtral-small-latest", "prices": [{ "input": 0.1, "output": 0.3 }], "released": "2025-07-15" },
|
|
156
162
|
{ "providerID": "moonshotai", "id": "kimi-k2.6", "prices": [{ "input": 0.95, "output": 4, "cache": { "read": 0.16 } }], "released": "2026-04-21" },
|
|
157
163
|
{ "providerID": "moonshotai", "id": "kimi-k2.7-code", "prices": [{ "input": 0.95, "output": 4, "cache": { "read": 0.19 } }], "released": "2026-06-12" },
|
|
158
164
|
{ "providerID": "moonshotai", "id": "kimi-k2.7-code-highspeed", "prices": [{ "input": 1.9, "output": 8, "cache": { "read": 0.38 } }], "released": "2026-06-12" },
|
|
159
|
-
{ "providerID": "moonshotai", "id": "kimi-k3", "prices": [{ "input": 3, "output": 15, "cache": { "read": 0.3 } }], "released": "2026-07-16" },
|
|
165
|
+
{ "providerID": "moonshotai", "id": "kimi-k3", "prices": [{ "input": 3, "output": 15, "cache": { "read": 0.3, "write": 3 } }], "released": "2026-07-16" },
|
|
160
166
|
{ "providerID": "nvidia", "id": "nvidia/llama-3.1-nemotron-70b-instruct", "prices": [{ "input": 0, "output": 0 }], "released": "2025-04-15" },
|
|
161
167
|
{ "providerID": "nvidia", "id": "nvidia/llama-3.1-nemotron-nano-8b-v1", "prices": [{ "input": 0, "output": 0 }], "released": "2025-03-18" },
|
|
162
168
|
{ "providerID": "nvidia", "id": "nvidia/llama-3.1-nemotron-nano-vl-8b-v1", "prices": [{ "input": 0, "output": 0 }], "released": "2025-04-10" },
|
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-10-
|
|
17
|
+
verified: "2026-10-08";
|
|
18
18
|
source: "https://models.dev/api.json";
|
|
19
19
|
entries: OfficialPriceEntry[];
|
|
20
20
|
};
|
package/docs/verification.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# 验证记录
|
|
2
2
|
|
|
3
|
+
## 2026-10-07 · SDK 2.0.24 升级
|
|
4
|
+
|
|
5
|
+
环境:macOS、Node.js v22.23.2、npm 10.9.8,插件包仍为 0.4.4。`@opencode/plugin`、`@opencode/client`、`@opencode/schema` 和 `@opencode/theme` 从 2.0.11 同步精确升级到 2.0.24;锁文件中的全部七个 OpenCode 包均为 2.0.24。OpenTUI 从 0.5.10 同步到 SDK 与 theme 配套的 0.5.14,没有追随独立发布的 0.5.15。未修改价格快照、未升插件包版本、未提交或推送、未实际发布 npm。
|
|
6
|
+
|
|
7
|
+
| 检查 | 结果 |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `npm ci --no-audit --no-fund` | Node 22 下通过,保留 OpenTUI 引擎警告 |
|
|
10
|
+
| `npm run typecheck` | 通过 |
|
|
11
|
+
| `npm test` | 103 项通过,新增两项媒体封装与旧宿主兼容回归测试 |
|
|
12
|
+
| `npm run build` | 通过 |
|
|
13
|
+
| `npm pack --dry-run` | 通过,完整执行 `prepack` 构建,包含 37 个发布文件 |
|
|
14
|
+
| `npm run test:smoke`,默认宿主 2.0.24 | 完整通过,打包、隔离安装、真实服务端与 TUI |
|
|
15
|
+
| `OPENCODE_BIN=… npm run test:smoke`,独立宿主 2.0.22 | 完整通过 |
|
|
16
|
+
| `OPENCODE_BIN=… npm run test:smoke`,独立宿主 2.0.11 | 完整通过 |
|
|
17
|
+
|
|
18
|
+
新版 `@opencode/ai` 将请求媒体从平铺的 `mediaType` / `data` 改为 `media` asset。上下文来源估算现在优先读取 `part.media.mediaType`,同时兼容旧宿主的 `part.mediaType`;有文件名时仍优先按文件名估算,缺少标签时不伪造媒体 token。新增测试覆盖 bytes、base64 和 URL 负载不会计入文本 token,以及旧格式与缺失标签。插件入口、请求钩子、RPC、客户端分页及 TUI 插槽无需迁移,实测五类 token、上下文和计费口径不变。
|
|
19
|
+
|
|
20
|
+
OpenTUI 0.5.14 的原生 Node 运行时声明 Node `>=26.4.0` / Bun `>=1.3.0`。本轮 Node 22 干净安装和打包安装均报告 `EBADENGINE`,未强制绕过或隐藏警告;类型检查、测试与构建不运行原生 Node TUI,真实终端验证使用 OpenCode 自带运行时。因此保留项目 Node 22+ 要求,但不宣称独立 Node 22 原生 TUI 渲染受支持;启用 npm `engine-strict` 时仍须满足该依赖的 Node 引擎要求。
|
|
21
|
+
|
|
22
|
+
三版宿主均保留并通过原有完整断言:空会话、切换到生成中的会话、实时 TPS / TTFT、完成后精确吞吐、`/usage` 的紧凑/详细模式与 100 / 48 列布局、子代理全树累计和浮窗、按消息模型计费、模型切换与原厂价格回退、删除会话清理 RPC,以及真实分叉和 compaction。分叉继承 ID 仍带 `_序号` 后缀,用量只归原来源但占用分叉本地 Context;真实 compaction 仍为 `status === "completed"`,完整升序历史保留压缩前消息,压缩边界后的新 assistant 恢复 Context。全树 Total 5,080、费用 `$0.00504`、上下文上限 128,000 → 32,000 和回退费用 `$0.000149` 均未变化。
|
|
23
|
+
|
|
24
|
+
旧版宿主使用校验 npm SHA-512 完整性的官方 `@opencode/cli-darwin-arm64` 独立二进制,未修改日常 OpenCode 安装、用户配置或调用付费模型。当前 SDK 的已验证宿主列表更新为 2.0.11、2.0.22、2.0.24;2.0.9 / 2.0.10 未在本轮复测,保留下方历史记录,不据 smoke 可运行范围扩展兼容声明。
|
|
25
|
+
|
|
26
|
+
验证产物:
|
|
27
|
+
- OpenCode 2.0.24:`/private/var/folders/rw/bmx6c8hd737brl55m0_ff_b80000gn/T/opencode/token-usage-smoke-gka7v0`。
|
|
28
|
+
- OpenCode 2.0.22:`/private/var/folders/rw/bmx6c8hd737brl55m0_ff_b80000gn/T/opencode/token-usage-smoke-RpSxaf`。
|
|
29
|
+
- OpenCode 2.0.11:`/private/var/folders/rw/bmx6c8hd737brl55m0_ff_b80000gn/T/opencode/token-usage-smoke-NQbaNC`。
|
|
30
|
+
|
|
3
31
|
## 2026-10-05 · 自动价格 patch 与 npm 发布链路(本地验证)
|
|
4
32
|
|
|
5
33
|
环境:macOS、Node.js v22.23.2、插件包仍为 0.4.4,SDK 仍锁定 2.0.11。本轮只修改价格更新与发布自动化、测试和文档,未更新真实价格快照、未推送提交或标签、未创建 GitHub Release,也未实际发布 npm。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chenlongapps/opencode-token-usage",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Session-tree token usage, live performance, context window and estimated cost for OpenCode 2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|
|
@@ -59,20 +59,20 @@
|
|
|
59
59
|
"registry": "https://registry.npmjs.org/"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@opencode/plugin": "2.0.
|
|
62
|
+
"@opencode/plugin": "2.0.24"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@opentui/core": "0.5.
|
|
66
|
-
"@opentui/solid": "0.5.
|
|
65
|
+
"@opentui/core": "0.5.14",
|
|
66
|
+
"@opentui/solid": "0.5.14",
|
|
67
67
|
"solid-js": ">=1.9.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@babel/core": "^7.28.0",
|
|
71
|
-
"@opencode/client": "2.0.
|
|
72
|
-
"@opencode/schema": "2.0.
|
|
73
|
-
"@opencode/theme": "2.0.
|
|
74
|
-
"@opentui/core": "0.5.
|
|
75
|
-
"@opentui/solid": "0.5.
|
|
71
|
+
"@opencode/client": "2.0.24",
|
|
72
|
+
"@opencode/schema": "2.0.24",
|
|
73
|
+
"@opencode/theme": "2.0.24",
|
|
74
|
+
"@opentui/core": "0.5.14",
|
|
75
|
+
"@opentui/solid": "0.5.14",
|
|
76
76
|
"@types/node": "^22.0.0",
|
|
77
77
|
"@xterm/headless": "6.0.0",
|
|
78
78
|
"babel-preset-solid": "1.9.12",
|