@chenlongapps/opencode-token-usage 0.4.4 → 0.4.5
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/prices.generated.d.ts +15 -4
- package/dist/prices.generated.js +3 -2
- package/dist/pricing.d.ts +1 -1
- package/docs/pricing.md +4 -2
- package/docs/verification.md +20 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -99,7 +99,9 @@ npm run build
|
|
|
99
99
|
npm run test:smoke
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
The [price update workflow](.github/workflows/update-prices.yml) checks models.dev every day at
|
|
102
|
+
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
|
+
|
|
104
|
+
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.
|
|
103
105
|
|
|
104
106
|
For a manual refresh, run `npm run prices:update` in a networked environment, review the generated diff and exceptions, then run the checks above. Builds and plugin refreshes do not contact models.dev.
|
|
105
107
|
|
package/README.zh-CN.md
CHANGED
|
@@ -99,7 +99,9 @@ npm run build
|
|
|
99
99
|
npm run test:smoke
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
[价格更新工作流](.github/workflows/update-prices.yml) 每天 UTC
|
|
102
|
+
[价格更新工作流](.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
|
+
|
|
104
|
+
验证失败不会升版本。已打标签但未完成的自动价格发布会优先重试同一版本,再检查新价格;registry 故障不会被当作版本不存在。发布时跳过 npm 已有版本、防止 `latest` 倒退,并在发布后核验 registry 中的版本。新增原厂/来源白名单、别名及人工核实的价格例外仍需人工审核。配置和重试方法见[发布说明](docs/releasing.md)。
|
|
103
105
|
|
|
104
106
|
手动更新时,在联网的维护环境运行 `npm run prices:update`,审阅生成文件及例外差异,再执行上述检查。构建和插件刷新不会请求 models.dev。
|
|
105
107
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
2
|
-
readonly verified: "2026-10-
|
|
2
|
+
readonly verified: "2026-10-07";
|
|
3
3
|
readonly source: "https://models.dev/api.json";
|
|
4
4
|
readonly entries: readonly [{
|
|
5
5
|
readonly providerID: "ai21";
|
|
@@ -869,10 +869,10 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
869
869
|
readonly providerID: "deepseek";
|
|
870
870
|
readonly id: "deepseek-v4-pro";
|
|
871
871
|
readonly prices: readonly [{
|
|
872
|
-
readonly input: 0.
|
|
873
|
-
readonly output:
|
|
872
|
+
readonly input: 0.66;
|
|
873
|
+
readonly output: 1.98;
|
|
874
874
|
readonly cache: {
|
|
875
|
-
readonly read: 0.
|
|
875
|
+
readonly read: 0.022;
|
|
876
876
|
};
|
|
877
877
|
}];
|
|
878
878
|
readonly released: "2026-08-12";
|
|
@@ -1426,6 +1426,17 @@ export declare const GENERATED_PRICE_SNAPSHOT: {
|
|
|
1426
1426
|
};
|
|
1427
1427
|
}];
|
|
1428
1428
|
readonly released: "2024-11-01";
|
|
1429
|
+
}, {
|
|
1430
|
+
readonly providerID: "mistral";
|
|
1431
|
+
readonly id: "mistral-large-4";
|
|
1432
|
+
readonly prices: readonly [{
|
|
1433
|
+
readonly input: 0.68;
|
|
1434
|
+
readonly output: 2.09;
|
|
1435
|
+
readonly cache: {
|
|
1436
|
+
readonly read: 0.07;
|
|
1437
|
+
};
|
|
1438
|
+
}];
|
|
1439
|
+
readonly released: "2026-10-06";
|
|
1429
1440
|
}, {
|
|
1430
1441
|
readonly providerID: "mistral";
|
|
1431
1442
|
readonly id: "mistral-large-latest";
|
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-07",
|
|
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" },
|
|
@@ -88,7 +88,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
88
88
|
{ "providerID": "deepseek", "id": "deepseek-flash", "prices": [{ "input": 0.15, "output": 0.6, "cache": { "read": 0.003 } }], "released": "2026-09-10" },
|
|
89
89
|
{ "providerID": "deepseek", "id": "deepseek-v4-flash", "prices": [{ "input": 0.15, "output": 0.6, "cache": { "read": 0.003 } }], "released": "2026-09-10" },
|
|
90
90
|
{ "providerID": "deepseek", "id": "deepseek-v4-flash-vision-exp", "prices": [{ "input": 0.15, "output": 0.6, "cache": { "read": 0.003 } }], "released": "2026-09-10" },
|
|
91
|
-
{ "providerID": "deepseek", "id": "deepseek-v4-pro", "prices": [{ "input": 0.
|
|
91
|
+
{ "providerID": "deepseek", "id": "deepseek-v4-pro", "prices": [{ "input": 0.66, "output": 1.98, "cache": { "read": 0.022 } }], "released": "2026-08-12" },
|
|
92
92
|
{ "providerID": "google", "id": "deep-research-max-preview-04-2026", "prices": [{ "input": 2, "output": 12, "cache": { "read": 0.2 } }, { "input": 4, "output": 18, "cache": { "read": 0.4 }, "tier": { "type": "context", "size": 200000 } }], "released": "2026-04-21" },
|
|
93
93
|
{ "providerID": "google", "id": "deep-research-preview-04-2026", "prices": [{ "input": 2, "output": 12, "cache": { "read": 0.2 } }, { "input": 4, "output": 18, "cache": { "read": 0.4 }, "tier": { "type": "context", "size": 200000 } }], "released": "2026-04-21" },
|
|
94
94
|
{ "providerID": "google", "id": "gemini-2.5-computer-use-preview-10-2025", "prices": [{ "input": 1.25, "output": 10 }, { "input": 2.5, "output": 15, "tier": { "type": "context", "size": 200000 } }], "released": "2025-10-07" },
|
|
@@ -136,6 +136,7 @@ export const GENERATED_PRICE_SNAPSHOT = {
|
|
|
136
136
|
{ "providerID": "mistral", "id": "ministral-8b-latest", "prices": [{ "input": 0.1, "output": 0.1 }], "released": "2024-10-01" },
|
|
137
137
|
{ "providerID": "mistral", "id": "mistral-large-2411", "prices": [{ "input": 2, "output": 6 }], "released": "2024-11-18" },
|
|
138
138
|
{ "providerID": "mistral", "id": "mistral-large-2512", "prices": [{ "input": 0.5, "output": 1.5, "cache": { "read": 0.05 } }], "released": "2024-11-01" },
|
|
139
|
+
{ "providerID": "mistral", "id": "mistral-large-4", "prices": [{ "input": 0.68, "output": 2.09, "cache": { "read": 0.07 } }], "released": "2026-10-06" },
|
|
139
140
|
{ "providerID": "mistral", "id": "mistral-large-latest", "prices": [{ "input": 0.5, "output": 1.5, "cache": { "read": 0.05 } }], "released": "2024-11-01" },
|
|
140
141
|
{ "providerID": "mistral", "id": "mistral-medium-2505", "prices": [{ "input": 0.4, "output": 2 }], "released": "2025-05-07" },
|
|
141
142
|
{ "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-10-07";
|
|
18
18
|
source: "https://models.dev/api.json";
|
|
19
19
|
entries: OfficialPriceEntry[];
|
|
20
20
|
};
|
package/docs/pricing.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
## 更新方式
|
|
6
6
|
|
|
7
|
-
GitHub Actions [价格更新工作流](../.github/workflows/update-prices.yml) 每天 UTC
|
|
7
|
+
GitHub Actions [价格更新工作流](../.github/workflows/update-prices.yml) 每天 UTC 22:00 从 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
|
+
|
|
9
|
+
验证失败不升版本;并发修改 `main` 会令原子推送失败,不覆盖他人提交或留下孤立的远端标签。已推送但 npm 未完成的自动价格版本会先重试原标签,不再递增版本。npm 查询只有明确的 404 才视为版本不存在,网络错误会停止流程。工作流摘要记录快照条数与新增/移除/变化数量;最终 npm 结果见发布工作流。仓库推送权限与 npm Trusted Publishing 配置见[发布说明](releasing.md)。
|
|
8
10
|
|
|
9
11
|
本地手动更新可在联网的维护环境中运行:
|
|
10
12
|
|
|
@@ -15,7 +17,7 @@ npm test
|
|
|
15
17
|
npm run build
|
|
16
18
|
```
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
本地更新时,审阅生成文件与 `overrides.ts` 的差异后提交。更新脚本只请求 `https://models.dev/api.json`,从人工确认的**原厂 Provider + 自家模型系列**提取公开的文本模型价格;原厂平台上托管的其他厂商模型、OpenRouter 等网关报价、地域性/订阅制费率不作为回退价格来源。自动化不修改来源白名单、别名或人工例外。API 不标注模型的真实厂商,因此新增原厂或新系列需要维护者先审核并扩充 `ORIGINAL_PROVIDERS`,不能按相似名称自动猜测。
|
|
19
21
|
|
|
20
22
|
`src/prices.generated.ts` 是随 npm 包发布的离线快照:插件启动、刷新、构建、打包和测试均不请求 models.dev。`src/aliases.ts` 只记录无法按已知包装形式解决的厂商 slug 与精确模型 ID 差异;`src/overrides.ts` 只记录有原厂来源的缺失 SKU、已核实的例外费率及无法直接使用的 API 字段。普通价格变动通过重新生成快照维护,不往别名或例外表中增加常规型号。
|
|
21
23
|
|
package/docs/verification.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# 验证记录
|
|
2
2
|
|
|
3
|
+
## 2026-10-05 · 自动价格 patch 与 npm 发布链路(本地验证)
|
|
4
|
+
|
|
5
|
+
环境:macOS、Node.js v22.23.2、插件包仍为 0.4.4,SDK 仍锁定 2.0.11。本轮只修改价格更新与发布自动化、测试和文档,未更新真实价格快照、未推送提交或标签、未创建 GitHub Release,也未实际发布 npm。
|
|
6
|
+
|
|
7
|
+
| 检查 | 结果 |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `npm run typecheck` | 通过 |
|
|
10
|
+
| `npm test` | 101 项通过,新增 16 项价格刷新/发布回归验证 |
|
|
11
|
+
| `npm run build` | 通过 |
|
|
12
|
+
| `npm pack --dry-run` | 通过,执行真实 `prepack` 构建 |
|
|
13
|
+
| `npm publish --dry-run` | 通过,完整执行类型检查、101 项测试与构建;未写入 registry |
|
|
14
|
+
| GitHub 工作流 | 通过 actionlint 1.7.12、YAML 解析和 bash 语法检查;检查工具来自官方发行且校验 SHA-256 |
|
|
15
|
+
| npm 只读查询 | 当前 `0.4.4` 已存在;发布状态为 `published=true`,价格恢复状态为 `retry=false` |
|
|
16
|
+
|
|
17
|
+
发布测试在临时仓库和本地 bare remote 中实际运行 `npm version patch`、受限提交、带注释标签及 `git push --atomic`,验证 `0.4.4 → 0.4.5` 的两个 package 文件同步、仅提交三个允许文件、版本钩子不执行,以及并发更新 `main` 时不覆盖远端提交或留下孤立标签。另覆盖未完成价格版本按原标签重试、禁止每日任务发布未完成的手动版本、已占用版本/标签、registry 故障与错误响应、锁文件不一致、`latest` 倒退和发布可见性延迟。
|
|
18
|
+
|
|
19
|
+
价格刷新覆盖无变化时跨日期保持字节不变、忽略未导入的上游元数据,以及新增、移除、零价、缓存、Reasoning 和档位差异。独立临时副本将全部生成模型的已有费率改为另一组数字,重新运行价格与用量测试,确认正常调价不再被写死的旧费率断言拦住;算法固定夹具和人工价格例外的精确断言仍保留。
|
|
20
|
+
|
|
21
|
+
真实 GitHub 定时任务、机器人推送/Release/dispatch 和 npm OIDC 写入尚未执行;需将这些变更提交到默认分支,并满足发布说明中的权限及 Trusted Publisher 配置后,在实际工作流中验证。此次未重新运行 OpenCode TUI smoke,之前已验证的宿主结果保留在下方。
|
|
22
|
+
|
|
3
23
|
## 2026-10-02 · smoke 宿主版本策略与兼容性
|
|
4
24
|
|
|
5
25
|
环境:macOS、Node.js v22.23.2、插件包 0.4.3。OpenCode SDK 仍精确锁定 2.0.11,未随本机 CLI 升级;本机默认宿主为 Homebrew 安装的 OpenCode 2.0.22。旧版基准使用校验 npm SHA-512 完整性的官方 `@opencode/cli-darwin-arm64@2.0.11` 独立二进制,没有降级或修改日常安装。
|