@chenlongapps/opencode-token-usage 0.4.18 → 0.4.20
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/prices.generated.d.ts +61 -4
- package/dist/prices.generated.js +6 -2
- package/dist/pricing.d.ts +1 -1
- package/docs/pricing.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -143,7 +143,7 @@ npm run test:smoke
|
|
|
143
143
|
|
|
144
144
|
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.
|
|
145
145
|
|
|
146
|
-
The [price update workflow](.github/workflows/update-prices.yml) checks models.dev every
|
|
146
|
+
The [price update workflow](.github/workflows/update-prices.yml) checks models.dev every 4 hours (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`.
|
|
147
147
|
|
|
148
148
|
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 polls registry visibility for up to 10 minutes after publication, logging progress. A verification timeout is not proof that `npm publish` failed: check the registry and retry the same tag without bumping the version; already-published versions are not republished. Manufacturer/source allowlist additions, aliases, and manually verified price exceptions still require human review. See the [release guide](docs/releasing.md) for setup, verification timing, and retries.
|
|
149
149
|
|
package/README.zh-CN.md
CHANGED
|
@@ -143,7 +143,7 @@ npm run test:smoke
|
|
|
143
143
|
|
|
144
144
|
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+ 的最低要求不变。
|
|
145
145
|
|
|
146
|
-
[价格更新工作流](.github/workflows/update-prices.yml)
|
|
146
|
+
[价格更新工作流](.github/workflows/update-prices.yml) 每 4 小时检查 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`。
|
|
147
147
|
|
|
148
148
|
验证失败不会升版本。已打标签但未完成的自动价格发布会优先重试同一版本,再检查新价格;registry 故障不会被当作版本不存在。发布时跳过 npm 已有版本、防止 `latest` 倒退,并在发布后最多轮询 10 分钟核验 registry 可见性,输出进度。校验超时不代表 `npm publish` 失败:先检查 registry,再重试原标签,不另升版本;已发布版本不会重复发布。新增原厂/来源白名单、别名及人工核实的价格例外仍需人工审核。配置、校验时限和重试方法见[发布说明](docs/releasing.md)。
|
|
149
149
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
2
|
-
readonly verified: "2026-10
|
|
2
|
+
readonly verified: "2026-11-10";
|
|
3
3
|
readonly source: "https://models.dev/api.json";
|
|
4
4
|
readonly entries: readonly [{
|
|
5
5
|
readonly providerID: "ai21";
|
|
@@ -585,6 +585,31 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
585
585
|
};
|
|
586
586
|
}];
|
|
587
587
|
readonly released: "2026-09-01";
|
|
588
|
+
}, {
|
|
589
|
+
readonly providerID: "anthropic";
|
|
590
|
+
readonly id: "claude-fable-5-2";
|
|
591
|
+
readonly prices: readonly [{
|
|
592
|
+
readonly input: 8;
|
|
593
|
+
readonly output: 40;
|
|
594
|
+
readonly cache: {
|
|
595
|
+
readonly read: 0.2;
|
|
596
|
+
readonly write: 10;
|
|
597
|
+
};
|
|
598
|
+
}];
|
|
599
|
+
readonly released: "2026-11-09";
|
|
600
|
+
}, {
|
|
601
|
+
readonly providerID: "anthropic";
|
|
602
|
+
readonly id: "claude-fable-5-2-fast";
|
|
603
|
+
readonly providers: readonly ["anthropic"];
|
|
604
|
+
readonly prices: readonly [{
|
|
605
|
+
readonly input: 16;
|
|
606
|
+
readonly output: 80;
|
|
607
|
+
readonly cache: {
|
|
608
|
+
readonly read: 0.4;
|
|
609
|
+
readonly write: 20;
|
|
610
|
+
};
|
|
611
|
+
}];
|
|
612
|
+
readonly released: "2026-11-09";
|
|
588
613
|
}, {
|
|
589
614
|
readonly providerID: "anthropic";
|
|
590
615
|
readonly id: "claude-haiku-4-5";
|
|
@@ -1308,6 +1333,27 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1308
1333
|
};
|
|
1309
1334
|
}];
|
|
1310
1335
|
readonly released: "2026-09-25";
|
|
1336
|
+
}, {
|
|
1337
|
+
readonly providerID: "meta";
|
|
1338
|
+
readonly id: "muse-ember-1.0";
|
|
1339
|
+
readonly prices: readonly [{
|
|
1340
|
+
readonly input: 0.1;
|
|
1341
|
+
readonly output: 0.5;
|
|
1342
|
+
readonly cache: {
|
|
1343
|
+
readonly read: 0.004;
|
|
1344
|
+
};
|
|
1345
|
+
}, {
|
|
1346
|
+
readonly input: 0.3;
|
|
1347
|
+
readonly output: 1.5;
|
|
1348
|
+
readonly cache: {
|
|
1349
|
+
readonly read: 0.012;
|
|
1350
|
+
};
|
|
1351
|
+
readonly tier: {
|
|
1352
|
+
readonly type: "context";
|
|
1353
|
+
readonly size: 200000;
|
|
1354
|
+
};
|
|
1355
|
+
}];
|
|
1356
|
+
readonly released: "2026-11-09";
|
|
1311
1357
|
}, {
|
|
1312
1358
|
readonly providerID: "meta";
|
|
1313
1359
|
readonly id: "muse-spark-1.1";
|
|
@@ -1606,10 +1652,21 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1606
1652
|
readonly providerID: "mistral";
|
|
1607
1653
|
readonly id: "mistral-large-4";
|
|
1608
1654
|
readonly prices: readonly [{
|
|
1609
|
-
readonly input:
|
|
1610
|
-
readonly output:
|
|
1655
|
+
readonly input: 0.7;
|
|
1656
|
+
readonly output: 2.1;
|
|
1657
|
+
readonly cache: {
|
|
1658
|
+
readonly read: 0.07;
|
|
1659
|
+
};
|
|
1660
|
+
}];
|
|
1661
|
+
readonly released: "2026-10-06";
|
|
1662
|
+
}, {
|
|
1663
|
+
readonly providerID: "mistral";
|
|
1664
|
+
readonly id: "mistral-large-4-0-8";
|
|
1665
|
+
readonly prices: readonly [{
|
|
1666
|
+
readonly input: 0.7;
|
|
1667
|
+
readonly output: 2.1;
|
|
1611
1668
|
readonly cache: {
|
|
1612
|
-
readonly read: 0.
|
|
1669
|
+
readonly read: 0.07;
|
|
1613
1670
|
};
|
|
1614
1671
|
}];
|
|
1615
1672
|
readonly released: "2026-10-06";
|
package/dist/prices.generated.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const GENERATED_PRICE_SNAPSHOT = {
|
|
2
|
-
verified: "2026-10
|
|
2
|
+
verified: "2026-11-10",
|
|
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-03" },
|
|
@@ -50,6 +50,8 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
50
50
|
{ "providerID": "alibaba", "id": "qwq-plus", "prices": [{ "input": 0.8, "output": 2.4 }], "released": "2025-03-05" },
|
|
51
51
|
{ "providerID": "anthropic", "id": "claude-fable-5", "prices": [{ "input": 10, "output": 50, "cache": { "read": 1, "write": 12.5 } }], "released": "2026-06-07" },
|
|
52
52
|
{ "providerID": "anthropic", "id": "claude-fable-5-1", "prices": [{ "input": 10, "output": 50, "cache": { "read": 0.25, "write": 12.5 } }], "released": "2026-09-01" },
|
|
53
|
+
{ "providerID": "anthropic", "id": "claude-fable-5-2", "prices": [{ "input": 8, "output": 40, "cache": { "read": 0.2, "write": 10 } }], "released": "2026-11-09" },
|
|
54
|
+
{ "providerID": "anthropic", "id": "claude-fable-5-2-fast", "providers": ["anthropic"], "prices": [{ "input": 16, "output": 80, "cache": { "read": 0.4, "write": 20 } }], "released": "2026-11-09" },
|
|
53
55
|
{ "providerID": "anthropic", "id": "claude-haiku-4-5", "prices": [{ "input": 1, "output": 5, "cache": { "read": 0.1, "write": 1.25 } }], "released": "2025-10-15" },
|
|
54
56
|
{ "providerID": "anthropic", "id": "claude-haiku-4-5-20251001", "prices": [{ "input": 1, "output": 5, "cache": { "read": 0.1, "write": 1.25 } }], "released": "2025-10-15" },
|
|
55
57
|
{ "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" },
|
|
@@ -110,6 +112,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
110
112
|
{ "providerID": "inception", "id": "mercury-edit-2", "prices": [{ "input": 0.25, "output": 0.75, "cache": { "read": 0.025 } }], "released": "2026-03-30" },
|
|
111
113
|
{ "providerID": "longcat", "id": "longcat-2.0", "prices": [{ "input": 0.3, "output": 1.2, "cache": { "read": 0.006 } }], "released": "2026-06-30" },
|
|
112
114
|
{ "providerID": "longcat", "id": "longcat-2.5-preview", "prices": [{ "input": 0.3, "output": 1.2, "cache": { "read": 0.006 } }], "released": "2026-09-25" },
|
|
115
|
+
{ "providerID": "meta", "id": "muse-ember-1.0", "prices": [{ "input": 0.1, "output": 0.5, "cache": { "read": 0.004 } }, { "input": 0.3, "output": 1.5, "cache": { "read": 0.012 }, "tier": { "type": "context", "size": 200000 } }], "released": "2026-11-09" },
|
|
113
116
|
{ "providerID": "meta", "id": "muse-spark-1.1", "prices": [{ "input": 1.25, "output": 4.25, "cache": { "read": 0.15 } }], "released": "2026-04-08" },
|
|
114
117
|
{ "providerID": "meta", "id": "muse-spark-1.2", "prices": [{ "input": 1.25, "output": 4.25, "cache": { "read": 0.15 } }], "released": "2026-08-05" },
|
|
115
118
|
{ "providerID": "meta", "id": "muse-spark-1.2-contributor", "prices": [{ "input": 0.1, "output": 0.2, "cache": { "read": 0.002 } }], "released": "2026-08-05" },
|
|
@@ -137,7 +140,8 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
137
140
|
{ "providerID": "mistral", "id": "ministral-8b-2512", "prices": [{ "input": 0.15, "output": 0.15, "cache": { "read": 0.015 } }], "released": "2025-12-02" },
|
|
138
141
|
{ "providerID": "mistral", "id": "ministral-8b-latest", "prices": [{ "input": 0.15, "output": 0.15, "cache": { "read": 0.015 } }], "released": "2024-10-01" },
|
|
139
142
|
{ "providerID": "mistral", "id": "mistral-large-2512", "prices": [{ "input": 0.5, "output": 1.5, "cache": { "read": 0.05 } }], "released": "2024-11-01" },
|
|
140
|
-
{ "providerID": "mistral", "id": "mistral-large-4", "prices": [{ "input":
|
|
143
|
+
{ "providerID": "mistral", "id": "mistral-large-4", "prices": [{ "input": 0.7, "output": 2.1, "cache": { "read": 0.07 } }], "released": "2026-10-06" },
|
|
144
|
+
{ "providerID": "mistral", "id": "mistral-large-4-0-8", "prices": [{ "input": 0.7, "output": 2.1, "cache": { "read": 0.07 } }], "released": "2026-10-06" },
|
|
141
145
|
{ "providerID": "mistral", "id": "mistral-large-latest", "prices": [{ "input": 0.5, "output": 1.5, "cache": { "read": 0.05 } }], "released": "2024-11-01" },
|
|
142
146
|
{ "providerID": "mistral", "id": "mistral-medium-2505", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-05-07" },
|
|
143
147
|
{ "providerID": "mistral", "id": "mistral-medium-2508", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-08-12" },
|
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-11-10";
|
|
18
18
|
source: "https://models.dev/api.json";
|
|
19
19
|
entries: OfficialPriceEntry[];
|
|
20
20
|
};
|
package/docs/pricing.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 更新方式
|
|
6
6
|
|
|
7
|
-
GitHub Actions [价格更新工作流](../.github/workflows/update-prices.yml)
|
|
7
|
+
GitHub Actions [价格更新工作流](../.github/workflows/update-prices.yml) 每 4 小时从 models.dev 检查一次,也可从 Actions 页面在 `main` 上手动触发。生成快照没有差异就结束,不会因检查日期或 API 中未导入的元数据变化发布新版本。白名单内的快照有变化(包含新增、移除和重新定价)时,先运行类型检查、测试、构建和 `npm pack --dry-run`,全部通过后自动升级 patch 版本,只提交 `src/prices.generated.ts`、`package.json`、`package-lock.json`,原子推送 `main` 与版本标签,再创建 GitHub Release 并显式触发 `publish.yml` 自动发布 npm。
|
|
8
8
|
|
|
9
9
|
验证失败不升版本;并发修改 `main` 会令原子推送失败,不覆盖他人提交或留下孤立的远端标签。已推送但 npm 未完成的自动价格版本会先重试原标签,不再递增版本。npm 查询只有明确的 404 才视为版本不存在,网络错误会停止流程。工作流摘要记录快照条数与新增/移除/变化数量;最终 npm 结果见发布工作流。仓库推送权限与 npm Trusted Publishing 配置见[发布说明](releasing.md)。
|
|
10
10
|
|
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.20",
|
|
4
4
|
"description": "OpenCode 2 plugin for session-tree token usage, context window monitoring, estimated costs, and performance metrics (TPS, TTFT, run time).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|