dsh-cost-meter 1.8.34 → 1.8.35
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 +12 -7
- package/README.zh-CN.md +12 -7
- package/docs/billing-statistics.md +4 -0
- package/docs/dsh-alpha5-compatibility.md +43 -0
- package/docs/update-notes-1.8.35.md +22 -0
- package/docs/web-request-fees.md +32 -0
- package/lib/backfill.js +5 -4
- package/lib/billing-statistics.js +2 -1
- package/lib/client.js +1 -1
- package/lib/client.pricing.js +2 -2
- package/lib/client.statistics.js +8 -8
- package/lib/index.js +3 -2
- package/lib/native-search-billing.js +40 -28
- package/lib/native-search-events.js +2 -0
- package/lib/native-search-fetch.js +5 -2
- package/lib/native-search-history.js +1 -0
- package/lib/plan-billing.js +2 -0
- package/lib/repair-sessions-cli.js +42 -20
- package/lib/store.js +6 -4
- package/lib/trajectory.js +6 -3
- package/lib/turn-cost.js +9 -0
- package/lib/typert.host.js +1 -1
- package/lib/web-request-pricing.js +15 -0
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -10,13 +10,18 @@ Community and feedback: [Join the WeChat group →](#community). The WeChat grou
|
|
|
10
10
|
|
|
11
11
|
Per-conversation cost · daily totals · OpenCode Go subscription quota display · budget with usage percentage · official account balance · custom provider balance · balance progress bar · history · peak/off-peak pricing hours display (peak hours UTC 01:00–04:00, 06:00–10:00; weekends and Chinese public holidays are off-peak all day, with separate labels) · pre-switch popup & system-notification alerts for peak/off-peak changes (position / lead time / alert type configurable) · one-click price sync from the official docs · Codex-style token usage heat grid · multi-vendor model pricing (built-in 170+ model-ID catalog with auto-matching) · mainstream Coding Plan quota queries & display (Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet / Volcano Ark / Qwen / Xiaomi MiMo / Factory Droid) plan/API dual-track billing (subscription quota vs pay-as-you-go money separated, per-1% & full-window token/equivalent-cost estimates with daily/weekly/monthly curves) · · quota strip above the input box (budget / Go / coding-plan usage in one row, toggleable)
|
|
12
12
|
|
|
13
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
14
14
|
|
|
15
|
-
**v1.8.
|
|
15
|
+
**v1.8.35** verifies [DSH 0.2.1-alpha.5 compatibility](docs/dsh-alpha5-compatibility.md#english) and adapts the offline session repair command to its persistence plugin. Daily billing logic is unchanged.
|
|
16
|
+
|
|
17
|
+
Supports [official Search/Fetch request fees](docs/web-request-fees.md#english), separately from model tokens.
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
Desktop users: follow the [Desktop installation instructions](docs/install-troubleshooting.md#desktop-安装与更新) for the application's own CLI and `desktop` Profile.
|
|
18
21
|
|
|
19
|
-
Release notes: [
|
|
22
|
+
Release notes: [DSH alpha.5 compatibility — v1.8.35](docs/update-notes-1.8.35.md#english). Fully restart DSH after updating.
|
|
23
|
+
|
|
24
|
+
DSH **0.2.1-alpha.5** is verified: daily billing also works with v1.8.34; use v1.8.35 for the offline repair command on this host. See the [compatibility checks](docs/dsh-alpha5-compatibility.md#english).
|
|
20
25
|
|
|
21
26
|
If startup reports **Ledger is busy** and the cost widgets are missing, see [ledger lock recovery](docs/ledger-lock-recovery.md#english).
|
|
22
27
|
|
|
@@ -327,22 +332,22 @@ On Node.js 20, use `npm install -g pnpm@10` instead. See [pnpm installation and
|
|
|
327
332
|
dsh plugin --profile web add dsh-cost-meter
|
|
328
333
|
```
|
|
329
334
|
|
|
330
|
-
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.8.
|
|
335
|
+
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.8.35`** — review the script before running):
|
|
331
336
|
|
|
332
337
|
```powershell
|
|
333
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.
|
|
338
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.35/install.ps1 | iex
|
|
334
339
|
```
|
|
335
340
|
|
|
336
341
|
**Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
|
|
337
342
|
|
|
338
343
|
```sh
|
|
339
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.
|
|
344
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.35
|
|
340
345
|
```
|
|
341
346
|
|
|
342
347
|
Without git, use the GitHub tag archive:
|
|
343
348
|
|
|
344
349
|
```sh
|
|
345
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.
|
|
350
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.35.tar.gz
|
|
346
351
|
```
|
|
347
352
|
|
|
348
353
|
After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
|
package/README.zh-CN.md
CHANGED
|
@@ -10,13 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
本会话费用 · 当日费用 · OpenCode Go 订阅额度显示 · 预算与已用百分比 · 官方账户余额 · 自定义 Provider 余额查询(可配任意 HTTP 端点) · 余额三段进度条 · 历史记录 · 峰谷计价时段显示(UTC 01:00–04:00、06:00–10:00 为峰时段;周末与中国法定假日全天按谷价,分别标注) · 峰/谷切换前弹窗与系统通知提醒(位置/提前量/提醒类型可配) · 官方价格一键同步 · 类 Codex Token 用量热图 · 多厂商多模型价格计费(内置 170+ 模型 ID 价格目录与自动匹配) · 主流 Coding Plan 额度查询与显示(Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet / 火山方舟 / 千问 / 小米 MiMo 十一家,含 Volcano Ark AK/SK 签名与 MiMo 控制台 Cookie 查询) · Plan/API 双轨计费(订阅额度与按量金额分离统计,每 1% 额度与满窗的 token/等值金额估算及日/周/月曲线) · 输入框上方额度横条(预算/Go/Coding Plan 用量一条横排显示,可开关)
|
|
12
12
|
|
|
13
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
14
14
|
|
|
15
|
-
**v1.8.
|
|
15
|
+
**v1.8.35** 完成 [DSH 0.2.1-alpha.5 兼容验证](docs/dsh-alpha5-compatibility.md#中文),适配新宿主的旧会话离线修复命令,日常计费逻辑保持不变。
|
|
16
|
+
|
|
17
|
+
新增 [DeepSeek Search/Fetch API 次数费](docs/web-request-fees.md#中文),只计有结果的成功请求,并将网页抓取独立分类。
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
桌面端用户请按 [Desktop 安装说明](docs/install-troubleshooting.md#desktop-安装与更新),使用应用自带的 CLI 和 `desktop` Profile。
|
|
18
21
|
|
|
19
|
-
更新说明:[v1.8.
|
|
22
|
+
更新说明:[v1.8.35 DSH alpha.5 适配](docs/update-notes-1.8.35.md#中文)。更新后完全重启 DSH。
|
|
23
|
+
|
|
24
|
+
已验证 DSH **0.2.1-alpha.5**:v1.8.34 日常计费可直接使用;在该宿主上运行离线修复命令请使用 v1.8.35。见[兼容性验证说明](docs/dsh-alpha5-compatibility.md#中文)。
|
|
20
25
|
|
|
21
26
|
启动报 **Ledger is busy** 且费用卡片消失时,参见[账本锁恢复说明](docs/ledger-lock-recovery.md#简体中文)。
|
|
22
27
|
|
|
@@ -327,22 +332,22 @@ Node.js 20 请改用 `npm install -g pnpm@10`。版本要求见 [pnpm 官方安
|
|
|
327
332
|
dsh plugin --profile web add dsh-cost-meter
|
|
328
333
|
```
|
|
329
334
|
|
|
330
|
-
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.8.
|
|
335
|
+
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.8.35`**,建议先下载审阅再运行):
|
|
331
336
|
|
|
332
337
|
```powershell
|
|
333
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.
|
|
338
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.35/install.ps1 | iex
|
|
334
339
|
```
|
|
335
340
|
|
|
336
341
|
**或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
|
|
337
342
|
|
|
338
343
|
```sh
|
|
339
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.
|
|
344
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.35
|
|
340
345
|
```
|
|
341
346
|
|
|
342
347
|
没有 git 时可用 GitHub tag 打包直链:
|
|
343
348
|
|
|
344
349
|
```sh
|
|
345
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.
|
|
350
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.35.tar.gz
|
|
346
351
|
```
|
|
347
352
|
|
|
348
353
|
安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
|
|
@@ -13,6 +13,8 @@ The conversation **Cost details** view defaults to the treemap and offers four l
|
|
|
13
13
|
|
|
14
14
|
Tool categories attribute the model-call cost of the associated step; they do not invent a separate execution price for a file read or command. Native search charges remain separate recorded billing events. Shares always use the whole conversation's selected cost basis.
|
|
15
15
|
|
|
16
|
+
Web fetching has its own activity category. Official standalone Search/Fetch request fees use request counts and per-request rates, with no additional model tokens. Local HTTP fetching is not assigned an official API fee. See [billing scope](web-request-fees.md#english).
|
|
17
|
+
|
|
16
18
|
The host prepares recently viewed conversations in the background at startup and refreshes them after completed turns. Conversation entry buttons also prefetch usage totals and fee categories. Calculated fees and price-independent usage metadata survive restarts; saved results appear first while changed logs refresh silently. View switches, sorting and paging share one calculation, and categories can display before call totals finish loading. Changes to price rules, plan ownership or subagent inclusion recalculate from the metadata cache; changed logs are reread. Caches are bounded and contain no message bodies, tool arguments, results or credentials.
|
|
17
19
|
|
|
18
20
|
The step-cost share distribution groups many small steps into four ranges: below 0.1%, 0.1–1%, 1–5% and at least 5% of conversation costs. Each range shows step count and cumulative cost. Zero-cost and unpriced usage stay separate. Step details default to a global highest-cost-first ranking, with a trajectory-order option. Twenty rows are shown initially and more expand in place. Clicking a step opens a detail dialog. Category and agent dialogs list their steps by cost and show the selected call beside the list. Only that call’s recorded content is loaded; the close button remains visible while scrolling, and Escape returns to the underlying view. The individual-call section uses a highest-cost ranking with bars scaled to its largest call, alongside each amount and share of the whole conversation; remaining calls are summarized as text.
|
|
@@ -62,6 +64,8 @@ The statistics screen uses DSH's package-local asynchronous module loader. Since
|
|
|
62
64
|
|
|
63
65
|
工具分类统计的是关联步骤的模型调用费用,不为读取文件、执行命令另造单价。原生搜索独立计费记录继续单独计算。占比始终以当前口径下的整段对话费用为分母。
|
|
64
66
|
|
|
67
|
+
网页抓取独立分类。官方独立 Search/Fetch API 的次数费显示次数和每次单价,不增加模型 Token;本地 HTTP 抓取不套用官方请求费。[计费范围](web-request-fees.md#中文)
|
|
68
|
+
|
|
65
69
|
「单步费用占比分布」把小费用归到低于 0.1%、0.1%–1%、1%–5% 和不低于 5% 四个区间,显示步数及累计金额。零费用和未定价记录单列。逐步费用明细默认按整段对话的金额从高到低排列,也可切回轨迹顺序;先显示 20 行,更多原位展开。点击步骤打开详情弹窗;点击类别或代理时,弹窗按金额排列其步骤,并在旁边显示选中调用。只读取选中调用的正文,关闭按钮始终可见,按 Escape 返回原视图。逐次调用区域用高额调用排名代替圆环图,横条相对最高单笔金额缩放,同时显示金额和占整段对话的比例;其余调用仅作文字合计。
|
|
66
70
|
|
|
67
71
|
从 1.8.13 起,可在**设置 → 费用 → 显示**开启“**输入区下方只显示金额(悬停可见完整分项)**”。费用行只显示金额,悬停保留命中率、输入/缓存/输出 Token 与模型金额。API 和 Plan 等值继续使用当前展示口径,标题栏徽章及“费用明细”入口保持原有行为;默认关闭。
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# DSH 0.2.1-alpha.5 兼容性
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
本版另新增 [DeepSeek Search/Fetch API 次数费](web-request-fees.md#中文):成功且有结果的请求 ¥0.005/次,保留调用时汇率;本地 HTTP 抓取不增加次数费。模型 Token 费率保持不变,内置搜索免费期不猜测结束日期。
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
核对日期:2026-10-16。目标为官方 [dsh-v0.2.1-alpha.5](https://github.com/deepseek-ai/deepseek-harness/releases/tag/dsh-v0.2.1-alpha.5),比较基线为 alpha.4。
|
|
9
|
+
|
|
10
|
+
**日常计费与界面在 v1.8.34 即可使用,原有模型 Token 计费无需调整。离线修复命令在新宿主上需升级到 v1.8.35。** 已在隔离的 Windows 测试环境中通过真实 CLI 安装 v1.8.34 公开发布包,启动 Web 宿主,确认凭据与路径模块复用宿主实例,三次合成用量全部入账。测试未使用真实账户、原有会话或模型 API。
|
|
11
|
+
|
|
12
|
+
与本插件有关的变化如下:
|
|
13
|
+
|
|
14
|
+
| 宿主变化 | 对费用插件的影响 |
|
|
15
|
+
|---|---|
|
|
16
|
+
| 新增 `conversation.input.model.label` Slot | 仅供自定义模型名称展示;本插件按 provider/model ID 计价,不按显示名称计价,无需接管这个 Slot。 |
|
|
17
|
+
| 收起右侧栏时使用 `overflow: clip` | 费用浮层已有 portal 挂载,不依赖侧栏溢出;真实 alpha.5 SlotCore 与发布版 dsh-context 的侧栏、会话页及弹窗联动检查通过。 |
|
|
18
|
+
| 技能菜单刷新、终端查询合并、PTC 提示调整 | 不改变费用插件使用的用量计数与价格接口。PTC 提示变化可能改变实际输入长度,费用仍按上报用量计算。 |
|
|
19
|
+
| 账户通知字段更宽松 | 该变化属于通知数据;本插件读取的钱包余额结构不受影响。 |
|
|
20
|
+
|
|
21
|
+
离线修复工具原来直接使用宿主导出的存储类。新宿主只导出插件入口,旧工具会安全拒绝 `--write`。v1.8.35 通过官方插件在空临时目录加载存储服务,只调用其独占锁接口,初始化不会打开或迁移用户会话。取得真实锁后仍由原修复流程备份并修改限定事件,宿主已持锁时拒绝写入。新旧宿主的普通与 Zstandard 日志均验证实际 CLI 修复、原样备份和重启后继续追加。
|
|
22
|
+
|
|
23
|
+
实际验证覆盖安装准入与启动、三个合成用量的持久化、配置读写、RPC 热加载与卸载、原生搜索计费,以及真实 Session / TokenMeter / ProjectionRegistry。浏览器使用实际发布的 dsh-context 0.68.1 与 alpha.5 的 SlotCore、会话页签逻辑,检查三个入口、反复开关、会话隔离、压缩校准总量和只改变上下文占用时的刷新。
|
|
24
|
+
|
|
25
|
+
仓库补充 alpha.5 的兼容性标记,peer 范围明确包含 `^0.2.1-0`。原来的范围已能通过 DSH 使用 `includePrerelease` 的准入检查,实际安装也能复用宿主依赖;补充范围让标准 npm 的预发布版本匹配也一致,不表示旧包在 alpha.5 无法运行。
|
|
26
|
+
|
|
27
|
+
自动回归的“新宿主”原先锁在 0.2.0-rc.1,现更新为 alpha.5。RPC 测试按新网关要求加载实际 RemoteAccess 服务,并显式提供测试调用方身份;旧宿主仍保留原调用方式。以上调整不改变生产权限、价格、历史账本或客户端布局。
|
|
28
|
+
|
|
29
|
+
相对旧回归宿主,0.2.1 的凭据库会优先采用已保存的 Key,再回退环境变量。插件沿用宿主的 `credentials.resolve()` 结果;测试分别验证新旧优先级,以及余额专用 Key 的保存、清除和隔离,不改变真实凭据或自行覆盖宿主规则。
|
|
30
|
+
|
|
31
|
+
验证对象是隔离 Web 宿主及组件集成,没有把这些结果描述为实际 Desktop 应用的完整界面复测,也没有升级用户的 DSH 客户端。
|
|
32
|
+
|
|
33
|
+
## English
|
|
34
|
+
|
|
35
|
+
Verified on 2026-10-16 against the official DSH 0.2.1-alpha.5 release. The existing public **dsh-cost-meter v1.8.34** package installs and starts successfully, shares the host credential/path modules, and records all three synthetic usage calls. Existing model-token accounting remains supported. **The offline repair command needs v1.8.35 on this host.**
|
|
36
|
+
|
|
37
|
+
New hosts expose persistence as a plugin rather than an exported class. The repair CLI mounts that official plugin in an empty temporary root solely to obtain its native exclusive lease. Initialization cannot scan or migrate user logs. The original bounded repair, byte-identical backup and refusal under active ownership remain intact; plain and Zstandard artifacts are tested through the actual CLI and a subsequent host restart on both old and new hosts.
|
|
38
|
+
|
|
39
|
+
The new model-label Slot is optional: pricing continues to use provider/model IDs rather than display labels. Sidebar clipping does not require changing the plugin's portal-based overlays. Skill, terminal, prompt and account-notification changes do not alter the billing interfaces consumed here. Prompt changes can affect actual input length; reported usage remains the billing source.
|
|
40
|
+
|
|
41
|
+
The repository adds the tested release marker and an explicit `^0.2.1-0` peer range for standard npm prerelease matching. DSH's existing prerelease-aware admission already accepts the old package, as confirmed by an actual installation. The next-host fixture advances from rc.1 to alpha.5; its RPC test loads the real RemoteAccess service and supplies an explicit local caller identity while retaining the older-host path. Production permissions, pricing, historical amounts and UI layout are unchanged.
|
|
42
|
+
|
|
43
|
+
Checks cover the real Web host, services and published context UI integration. They do not claim a full Desktop application UI test or upgrade the user's DSH application. No real credentials, user conversations or billable model requests are used.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# v1.8.35
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
本版另新增 [DeepSeek Search/Fetch API 次数费](web-request-fees.md#中文):成功且有结果的请求 ¥0.005/次,保留调用时汇率;本地 HTTP 抓取不增加次数费。模型 Token 费率保持不变,内置搜索免费期不猜测结束日期。
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
完成 DSH 0.2.1-alpha.5 兼容验证。现有 v1.8.34 的日常计费与界面可直接使用;本版补充兼容性声明和预发布 peer 范围,日常计费、价格和历史金额保持不变。
|
|
9
|
+
|
|
10
|
+
修复旧会话离线修复命令对新宿主的适配:新宿主不再公开存储类,改用官方插件在空临时目录中加载,只取得其独占锁接口。初始化不扫描、不迁移用户日志,继续保留写入前原样备份、锁冲突拒绝写入和旧宿主支持。
|
|
11
|
+
|
|
12
|
+
自动回归更新到 alpha.5,覆盖真实安装与 Web 启动、合成计费、RPC 热加载与卸载、原生搜索、上下文校准及发布版 dsh-context 联动。凭据测试分别验证新旧宿主优先级。
|
|
13
|
+
|
|
14
|
+
[完整验证范围与影响](dsh-alpha5-compatibility.md#中文)。升级后完全退出并重新打开 DSH。
|
|
15
|
+
|
|
16
|
+
## English
|
|
17
|
+
|
|
18
|
+
Verifies DSH 0.2.1-alpha.5 compatibility. Daily billing and UI already work in v1.8.34; this release updates compatibility metadata and prerelease peer ranges without changing billing, pricing or historical amounts.
|
|
19
|
+
|
|
20
|
+
Adapts the offline repair CLI to the new persistence plugin entry. The official backend is mounted in an empty temporary root only to obtain its exclusive lease, keeping user-log scanning and migration out of initialization. Existing backups, active-owner refusal and older-host support remain intact.
|
|
21
|
+
|
|
22
|
+
Automation covers real installation/startup, synthetic billing, hot RPC loading, native search and published context UI integration. See [verification scope](dsh-alpha5-compatibility.md#english). Fully restart DSH after upgrading.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# DeepSeek 网页搜索与抓取计费
|
|
2
|
+
|
|
3
|
+
## 中文
|
|
4
|
+
|
|
5
|
+
v1.8.35 支持官方 `POST /v1/tools/search` 和 `POST /v1/tools/fetch` 的次数费。根据 [官方指南](https://api-docs.deepseek.com/zh-cn/guides/search/)与[价格页](https://api-docs.deepseek.com/zh-cn/quick_start/pricing/),两者均为每 1,000 次成功请求 ¥5,即每次 ¥0.005。
|
|
6
|
+
|
|
7
|
+
- 只计 HTTP 200 且有结果的请求:Search 的 `results` 非空;Fetch 返回非空网页正文。搜索结果条数不影响价格。
|
|
8
|
+
- 失败、空结果、无正文、超时和取消不会凭空生成费用。同一请求同时经过网络诊断与 JSON 观察时只计一次,重试则分别判断是否成功。
|
|
9
|
+
- 费用计入会话、每日、预算及 API 支出;统计明细显示“搜索请求/抓取请求”和“次数 × 每次单价”。五类模型 Token 不增加,也不套用模型倍率、Coding Plan 或峰谷折扣。
|
|
10
|
+
- 记录保存在插件自己的用量文件中,保留请求标识、类型、单价和时间,不保存 URL、搜索词、页面正文或凭据。历史回放按请求去重,沿用调用当时的汇率;升级不为旧调用估补次数费。
|
|
11
|
+
|
|
12
|
+
**区分三个来源:**
|
|
13
|
+
|
|
14
|
+
| 来源 | 本版处理 |
|
|
15
|
+
|---|---|
|
|
16
|
+
| 官方独立 Search/Fetch API | 在 DSH 网页服务或工具执行期间观察真实成功响应,按上面的规则入账。支持直接工具调用及宿主网页服务调用。 |
|
|
17
|
+
| DSH 的本地 HTTP 抓取后端 | 没有官方 Fetch API 请求就不增加次数费。模型随后阅读网页的 Token 仍由正常用量记录计费。 |
|
|
18
|
+
| Anthropic/Responses 接口的内置搜索 | 保留现有模型用量计费。官方公告 Claude Code/Codex 内置搜索暂免 Search 请求费,正式开始计费时间另行通知;本版不猜测截止日期、不因工具名称或 `web_search_call` 等展示项额外收费。 |
|
|
19
|
+
|
|
20
|
+
只有官方域名和精确端点被纳入上述固定单价,第三方渠道不会被强行套价。没有会话/工具作用域的独立进程请求不在此插件的观察范围。插件不主动发起搜索或抓取,不替换提供方,不自动重试,也不修改宿主网络策略。
|
|
21
|
+
|
|
22
|
+
“网页抓取”在用途图、矩形图、代理归属和步骤筛选中独立显示。它汇总相关模型步骤与已观察到的 Fetch API 次数费;同一步混用搜索和抓取归入“多类工具”,费用只计一次。次数费不能作为模型价格表中的 Token 单价编辑。
|
|
23
|
+
|
|
24
|
+
验证使用真实 DSH 工具注册、Web 服务和 HTTP 传输,官方请求地址被测试连接固定到本机服务器;不使用真实 Key 或收费接口。另覆盖空结果、失败、并发会话、重复观察、重启、历史汇率和旧宿主。
|
|
25
|
+
|
|
26
|
+
## English
|
|
27
|
+
|
|
28
|
+
v1.8.35 meters the official standalone Search and Fetch endpoints separately from model tokens: CNY 5 per 1,000 successful requests. Only HTTP 200 with nonempty search results or fetched content is charged. Failures and empty results do not incur a request fee; the number of search results does not multiply it.
|
|
29
|
+
|
|
30
|
+
Request fees use their own billing rows, remain API expenses, and retain historical exchange rates. They do not add tokens or inherit model multipliers, peak discounts or subscriptions. Observations are limited to exact official endpoints in DSH web/tool execution scopes; local HTTP fetching and third-party providers are not assigned this price. Journals contain no queries, URLs, page bodies or credentials. The plugin makes no search/fetch requests itself.
|
|
31
|
+
|
|
32
|
+
Existing model-token accounting remains intact. The announced Claude Code/Codex built-in search waiver is not given an invented end date, and presentation items alone do not create charges. See the [official billing rules](https://api-docs.deepseek.com/guides/search/).
|
package/lib/backfill.js
CHANGED
|
@@ -552,7 +552,8 @@ export function replaySessionRecords(records, config, wantDates = null, collectS
|
|
|
552
552
|
// 计价/归类/归因一律用改挂后的 effectiveProvider(包装层转发对挂语义上游)。
|
|
553
553
|
const pricedAtMs = !isCompaction && !metered ? stepStarts.get(`${turn}:${step}`) ?? atMs : atMs
|
|
554
554
|
const pricing = pricingConfigAt(config, pricedAtMs, sessionId, `${effectiveProvider}:${sampleModel}`)
|
|
555
|
-
const
|
|
555
|
+
const requestFee = isNativeSearch ? event.data.requestFee : undefined
|
|
556
|
+
const resolved = requestFee ? { priced: true, entry: {}, currency: 'CNY', billingMode: 'flat' } : providerPriceEntryFor(effectiveProvider, sampleModel, pricing?.prices, {
|
|
556
557
|
mode: pricing?.priceMatch === 'exact' ? 'exact' : 'auto',
|
|
557
558
|
overrides: pricing?.priceOverrides,
|
|
558
559
|
})
|
|
@@ -564,13 +565,13 @@ export function replaySessionRecords(records, config, wantDates = null, collectS
|
|
|
564
565
|
}
|
|
565
566
|
// 官方价格币种为人民币(issue #47)时,DeepSeek 主表计出的成本为人民币,
|
|
566
567
|
// 按展示汇率折算为美元入账——与 store.account() 完全同口径。
|
|
567
|
-
const priced = resolved.priced ? costOf(buckets, resolved.entry, pricedAtMs, peak) : 0
|
|
568
|
+
const priced = requestFee ? requestFee.requests * requestFee.rateCny : resolved.priced ? costOf(buckets, resolved.entry, pricedAtMs, peak) : 0
|
|
568
569
|
const canonical = usdFromCost(priced, resolved.currency, fxRatesOf(pricing).CNY)
|
|
569
570
|
const displayFactor = config._displayCurrency ? fxRatesOf(pricing)[config._displayCurrency] / config.exchangeRate : 1
|
|
570
571
|
const cost = canonical * displayFactor
|
|
571
572
|
// Plan/API 双轨分类(issue #64):与 store.account() 同一分类器,回放条目
|
|
572
573
|
// 的 apiCost 只含真金白银部分(plan 类金额仅记等值);传 prices 供路由判定。
|
|
573
|
-
const plan = billingClassOf(effectiveProvider, sampleModel, config?.planBilling, enabledPlanSetOf(config), config?.prices) === 'plan'
|
|
574
|
+
const plan = !requestFee && billingClassOf(effectiveProvider, sampleModel, config?.planBilling, enabledPlanSetOf(config), config?.prices) === 'plan'
|
|
574
575
|
const apiCost = plan ? 0 : cost
|
|
575
576
|
const providerKey = `${effectiveProvider}:${sampleModel}`
|
|
576
577
|
// 聚合目标按事件分段路由;被替换的旧样本从它当时所在的段扣回(与旧版
|
|
@@ -579,7 +580,7 @@ export function replaySessionRecords(records, config, wantDates = null, collectS
|
|
|
579
580
|
const sample = { key, date, providerKey, buckets, cost, apiCost, ...frozenAmounts(cost, apiCost, pricing), seed: isSeed }
|
|
580
581
|
if (samples) {
|
|
581
582
|
if (prev) samples.delete(prev)
|
|
582
|
-
samples.set(sample, { ...sample, displayFactor, exchangeRate: fxRatesOf(pricing).CNY, fxRates: fxRatesOf(pricing), pricedAtMs, atMs, logSeq: !metered && Number.isSafeInteger(event.seq) && event.seq >= 0 ? event.seq : null, provider: effectiveProvider, model: sampleModel, resolved, peak, plan, kind: isCompaction ? 'compaction' : isNativeSearch ? 'search' : 'model',
|
|
583
|
+
samples.set(sample, { ...sample, ...(requestFee ? { requestFee } : {}), displayFactor, exchangeRate: fxRatesOf(pricing).CNY, fxRates: fxRatesOf(pricing), pricedAtMs, atMs, logSeq: !metered && Number.isSafeInteger(event.seq) && event.seq >= 0 ? event.seq : null, provider: effectiveProvider, model: sampleModel, resolved, peak, plan, kind: isCompaction ? 'compaction' : requestFee ? requestFee.kind : isNativeSearch ? 'search' : 'model',
|
|
583
584
|
...(isBillion ? { metering: event.data.metering } : {}),
|
|
584
585
|
turn: Number.isSafeInteger(event.data?.turn) && event.data.turn >= 0 ? event.data.turn : null,
|
|
585
586
|
step: Number.isSafeInteger(event.data?.step) && event.data.step >= 0 ? event.data.step : null })
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { localDayKey } from './store.js'
|
|
3
3
|
import { providerPriceEntryFor } from './pricing.js'
|
|
4
4
|
import { conversationOwners } from './session-tree.js'
|
|
5
|
+
import { isWebRequestModel } from './web-request-pricing.js'
|
|
5
6
|
|
|
6
7
|
export const STAT_FIELDS = ['input', 'output', 'cacheRead', 'cacheWrite', 'reasoning', 'calls', 'cost', 'apiCost']
|
|
7
8
|
const num = n => typeof n === 'number' && Number.isFinite(n) && n > 0 ? n : 0
|
|
@@ -65,7 +66,7 @@ export function billingStatistics(ledger, raw, sessionIds = null, headers = [])
|
|
|
65
66
|
if (id.provider) providers.add(id.provider)
|
|
66
67
|
if (!query.provider || query.provider === id.provider) modelOptions.add(id.model)
|
|
67
68
|
if (!matchesStats(key, query)) continue
|
|
68
|
-
const row = models.get(key) ?? { key, ...id, ...emptyStats(), priced: providerPriceEntryFor(id.provider, id.model, ledger.config.prices, { mode: ledger.config.priceMatch, overrides: ledger.config.priceOverrides }).priced }
|
|
69
|
+
const row = models.get(key) ?? { key, ...id, ...emptyStats(), priced: isWebRequestModel(id.provider, id.model) || providerPriceEntryFor(id.provider, id.model, ledger.config.prices, { mode: ledger.config.priceMatch, overrides: ledger.config.priceOverrides }).priced }
|
|
69
70
|
add(row, bucket); add(modeled, bucket); models.set(key, row)
|
|
70
71
|
}
|
|
71
72
|
for (const session of day?.sessions ?? []) {
|