@feiyang666/dsh-usage-plugin 1.14.0 → 1.14.1
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/CHANGELOG.md +20 -5
- package/README.md +6 -0
- package/README.zh.md +6 -1
- package/lib/client.js +34 -11
- package/lib/index.js +44 -19
- package/package.json +2 -3
- package/RELEASE_NOTES.md +0 -46
package/CHANGELOG.md
CHANGED
|
@@ -8,9 +8,27 @@
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
## v1.14.
|
|
11
|
+
## v1.14.1 (2026-08-29)
|
|
12
|
+
|
|
13
|
+
### 修复 / Fixed
|
|
14
|
+
|
|
15
|
+
- **中断调用兜底记录,使「调用次数」与 DeepSeek 官方后台对齐**(`lib/index.js`):harness 在流被中断(aborted / error / timeout / 用户停止生成)时不会产出 `usage` chunk(usage 只在收到 `[DONE]` 哨兵后才由 adapter yield),导致这类调用此前完全不被插件记录——而官方后台仍会把该次请求计入「API 请求次数」并按实际 token 计费,于是插件统计的调用次数长期低于官方(如 8 月 27 日 985 vs 1033)。现在无 usage 但确为真实模型调用(通过 `isRealCall`,排除内部 `dsh2shell-*`/`fake`)的流,会在 `observe()` 的 `finally` 里补记一条 **0-token 的「中断调用」**(新增 `interrupted: true` 字段,`finishReason` 如实标记 `aborted`/`error`/`timeout`)。token 与费用均为 0,不会虚增消耗;调用次数与官方口径一致。
|
|
16
|
+
- **面板透明展示中断调用**(`lib/client.js`):
|
|
17
|
+
- 概览「调用次数」卡片新增 `· 中断 N(未计费)` 提示;
|
|
18
|
+
- 缓存命中列表与用量日历当日明细中,中断调用行在模型名旁显示红色「中断」徽标、结束原因红色标注、消耗列显示 `—`;
|
|
19
|
+
- PNG 导出报告同样在模型名旁标注「中断」、消耗列显示 `—`;
|
|
20
|
+
- 结束原因新增 `aborted → 已中断 / Interrupted`、`timeout → 超时 / Timeout` 映射(中英双语)。
|
|
21
|
+
- **用量面板顶部新增「本地统计与官方后台的差异」提示横幅**:说明本面板统计的是插件本地捕获的调用(官方价格 + 峰谷时段),与官方后台(platform.deepseek.com 用量页)相比金额可能更低——① 中断/出错/超时的调用官方仍按实际 token 计费而插件按 0 记录;② 账号下其他 API Key(其它应用/脚本)的调用不经过 DeepSeek Harness,官方包含而插件不包含;③ 精确对账可导出官方月度账单 CSV 对比。检测到中断调用时额外显示「当前记录中有 N 次中断调用(未计费)」红字提示。
|
|
22
|
+
- **持久化与 API 透传 `interrupted`**(`lib/index.js`):`normalizeRecord` / `projectRecord` 均保留该字段,重启恢复、`/usage/api` list 输出、JSON 导出一致。
|
|
23
|
+
|
|
24
|
+
### 测试 / Tests
|
|
12
25
|
|
|
13
|
-
|
|
26
|
+
- 新增 `test/interrupt.test.js`:验证中断兜底仅记录真实模型调用(DeepSeek 官方 / 第三方真实 provider),内部 `fake`/`dsh*` 占位调用永不兜底记录。
|
|
27
|
+
- 全部 30/30 通过。
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## v1.14.0 (2026-08-27)
|
|
14
32
|
|
|
15
33
|
### 新增 / New
|
|
16
34
|
|
|
@@ -277,6 +295,3 @@
|
|
|
277
295
|
- CSV / JSON / PNG 长图导出(最新在前,最多 2000 条,超出提示),支持自定义导出目录(原生目录选择器)与「打开所在目录」。
|
|
278
296
|
- JSON / CSV 导入合并,按时间去重。
|
|
279
297
|
- Windows / macOS / Linux 跨平台路径与原生操作适配;启动诊断日志 `dsh-usage-boot.log`。
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
📄 **英文发布说明入口(English release notes)**:[RELEASE_NOTES.md](./RELEASE_NOTES.md)
|
package/README.md
CHANGED
|
@@ -35,6 +35,8 @@ dsh-usage-plugin is a **usage & cost tracker** plugin in the DeepSeek Harness ec
|
|
|
35
35
|
- **Usage & Cost**: records each model call's token usage and cache hits (input miss / cache hit / cache write / output / reasoning / finish reason), and computes cost using DeepSeek's peak/valley or base pricing (peak hours on weekdays are automatically priced by Beijing time 09:00–12:00 and 14:00–18:00; since 2026-08-23 weekends are billed entirely at the off-peak rate). Model names come from the actual request parameters, so non-DeepSeek models are shown truthfully instead of "unknown model"; models without an official price are counted as 0. The overview shows a by-model table plus a by-API-provider × model drill-down (each provider grouped with every model's calls and peak/off-peak cost split) and a grand total row. The overview also supports **date filtering** (Today / Last 7 days / Last 30 days / All, plus a custom start–end range), so the aggregate stats can be scoped to any single day or date range.
|
|
36
36
|
- **Usage Calendar**: a monthly daily-usage heatmap (colored by cost or call count), hover for details including the peak/off-peak cost split, click a day for its call list and peak/off-peak totals, plus a per-day statistics table with peak cost / off-peak cost / total columns and monthly rollups.
|
|
37
37
|
- **Cache Hit List**: newest-first, fully scrollable, with quick filters (Today / 7 days / 30 days / All) and custom date ranges; the summary line and footer total split peak vs off-peak consumption with a grand cost total. The list is paginated (100 rows per page), so it stays smooth even with large data volumes.
|
|
38
|
+
- **Interrupted calls shown truthfully**: calls that were aborted / errored / timed out (e.g. manually stopped generation, stream interruption) are shown with a red **"Interrupted"** badge, the finish reason (Interrupted / Error / Timeout) and a `—` cost. The official console still counts these as API requests and bills their actual tokens, but the harness does not report their usage to the plugin — so the plugin records them at 0 tokens, keeping the **call count aligned with the official console** while costs are unaffected. The Overview's "Calls" card adds a `· interrupted N (not billed)` hint.
|
|
39
|
+
- **Local stats vs official console**: a fixed notice banner at the top of the panel explains that this panel reflects calls captured locally by the plugin (official prices + peak/off-peak hours), and that the official console (platform.deepseek.com usage page) may show a higher amount because: ① interrupted/failed/timed-out calls are still billed by the console while the plugin records them as 0; ② calls from other API keys on your account (other apps/scripts) do not pass through DeepSeek Harness — the console includes them, the plugin does not; ③ for exact reconciliation, export the official monthly billing CSV and compare. When interrupted calls are detected, the banner also shows a red "Current records include N interrupted call(s) (not billed)" line.
|
|
38
40
|
- **Price Table**: the official DeepSeek API price table (covering `deepseek-v4-flash` / `deepseek-v4-flash-vision-exp` / `deepseek-v4-pro`) — base and peak/valley unit prices shown side by side (peak vs off-peak), editable in-panel and persisted to `pricing.json`, with a reset-to-default option.
|
|
39
41
|
- **Balance Query**: queries your DeepSeek account balance using the configured `DEEPSEEK_API_KEY`.
|
|
40
42
|
- **Export**: CSV / JSON / **PNG long image** (newest-first, up to the latest 2000 records, warns if exceeded; the PNG report includes peak/off-peak cost columns), to any directory (native picker), auto-opens the folder after export.
|
|
@@ -309,6 +311,10 @@ pnpm dsh web
|
|
|
309
311
|
- **[@mumuer1024](https://github.com/mumuer1024)**: reported and diagnosed the persistence-path drift across workspaces (history "disappearing" / counted as 0) and proposed storing data in a fixed, dedicated directory ([#4](https://github.com/feiyang-dev/dsh-usage-plugin/issues/4)).
|
|
310
312
|
- **[@liu3734](https://github.com/liu3734)**: reported and diagnosed the Windows-only path handling / spawn issues on macOS (POSIX) and proposed the cross-platform fix ([#1](https://github.com/feiyang-dev/dsh-usage-plugin/issues/1)).
|
|
311
313
|
|
|
314
|
+
## Changelog
|
|
315
|
+
|
|
316
|
+
- [CHANGELOG.md](./CHANGELOG.md) — detailed notes for every release.
|
|
317
|
+
|
|
312
318
|
## License
|
|
313
319
|
|
|
314
320
|
MIT © dsh-usage-plugin
|
package/README.zh.md
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
[GitHub](https://github.com/feiyang-dev/dsh-usage-plugin) · [npm](https://www.npmjs.com/package/@feiyang666/dsh-usage-plugin) · MIT License
|
|
8
8
|
|
|
9
|
-
> 📄 **本版本英文发布说明(What’s New in v1.14.0)**:[RELEASE_NOTES.md](./RELEASE_NOTES.md)
|
|
10
9
|
|
|
11
10
|
**由开发者制作的 DeepSeek Harness 插件** —— 记录每一次模型调用的 token 用量与消耗,支持峰谷计费、余额查询、日历热力图与 CSV / JSON / PNG 导出。
|
|
12
11
|
|
|
@@ -37,6 +36,8 @@ dsh-usage-plugin 是 DeepSeek Harness 生态的**用量与消耗统计插件**
|
|
|
37
36
|
- **用量与消耗**:记录每次模型调用的 token 用量与缓存命中(输入·未命中 / 缓存命中 / 缓存写入 / 输出 / 推理 / 结束原因),按 DeepSeek 峰谷/基础价格计算消耗(工作日高峰时段按北京时间 9:00–12:00、14:00–18:00 计价;自 2026-08-23 起周末全天按空闲价计费)。模型名以请求参数为准如实显示(非 DeepSeek 模型不再显示为「未知模型」,无官方价格的模型消耗按 0 统计)。概览含「按模型」表与「按 API 服务商 × 模型」明细表(每个服务商一组,组内列出各模型的调用与高峰/空闲分列消耗),底部有总费用合计。概览还支持**日期筛选**(今天 / 近 7 天 / 近 30 天 / 全部,外加自定义起止区间),可将聚合统计限定到任意一天或日期范围。
|
|
38
37
|
- **用量日历**:按月查看每日用量热力图(按消耗或调用数着色),悬停查看详情(含高峰 / 空闲消耗拆分)、点击某天查看当日调用明细与高峰/空闲消耗统计,附本月每日统计表(高峰消耗 / 空闲消耗 / 总消耗分列)与月度汇总。
|
|
39
38
|
- **缓存命中列表**:最新记录排在最前,支持 今天 / 近7天 / 近30天 / 全部 快捷筛选与自定义起止日期区间,汇总行与表尾合计区分高峰消耗 / 空闲消耗 / 总费用合计;列表分页渲染(每页 100 条),记录量大也不卡顿。
|
|
39
|
+
- **中断调用如实呈现**:被中止 / 出错 / 超时(如手动停止生成、流中断)的调用在面板中标红显示「中断」徽标、结束原因(已中断 / 错误 / 超时)与消耗 `—`。这类调用官方后台仍会计入「API 请求次数」并按实际 token 计费,但 harness 不向插件上报 usage——插件按 0 token 记录它们,**调用次数与官方口径一致,消耗不受影响**;概览「调用次数」卡片会提示 `中断 N(未计费)`。
|
|
40
|
+
- **本地统计 vs 官方后台的差异提示**:用量面板顶部固定显示说明横幅——本面板统计的是插件本地捕获的调用(官方价格 + 峰谷时段),与官方后台(platform.deepseek.com 用量页)相比金额可能更低:① 中断/出错/超时的调用官方仍按实际 token 计费而插件按 0 记录;② 账号下其他 API Key(其它应用/脚本)的调用不经过 DeepSeek Harness,官方包含而插件不包含;③ 精确对账可导出官方月度账单 CSV 对比。检测到中断调用时,横幅额外以红字显示「当前记录中有 N 次中断调用(未计费)」。
|
|
40
41
|
- **价格表**:**DeepSeek 官方 API 价格表**(覆盖官方模型 `deepseek-v4-flash` / `deepseek-v4-flash-vision-exp` / `deepseek-v4-pro`),展示基础价与峰谷价(高峰/空闲)单价表,高峰价与空闲价分列展示,支持在面板内直接编辑价格并持久化(数据目录 `pricing.json`),也可一键恢复默认。
|
|
41
42
|
- **剩余余额查询**:用当前配置的 `DEEPSEEK_API_KEY` 查询 DeepSeek 账户余额;并支持 **百炼 Token Plan 配额查询**(复用 `bl auth login --console` 的控制台 OAuth token,无需阿里云 AccessKey,展示本周配额已用百分比与重置时间)。
|
|
42
43
|
- **导出**:CSV / JSON / **PNG 长图**(按最新在前展示,最多含最近 2000 条,超出会提示;PNG 报告含高峰 / 空闲消耗分列统计),可导出到任意目录(原生目录选择器),导出后自动打开所在目录。
|
|
@@ -311,6 +312,10 @@ pnpm dsh web
|
|
|
311
312
|
- **[@mumuer1024](https://github.com/mumuer1024)**:报告并定位了持久化路径随会话工作区漂移导致历史数据"消失/统计为 0"的问题,提出把数据写到固定专用目录的方案([#4](https://github.com/feiyang-dev/dsh-usage-plugin/issues/4))。
|
|
312
313
|
- **[@liu3734](https://github.com/liu3734)**:报告并定位 macOS(POSIX)下路径处理与 spawn 的 Windows 专用问题,提出跨平台修复方案([#1](https://github.com/feiyang-dev/dsh-usage-plugin/issues/1))。
|
|
313
314
|
|
|
315
|
+
## 更新日志
|
|
316
|
+
|
|
317
|
+
- [CHANGELOG.md](./CHANGELOG.md) —— 每次发布的详细更新内容。
|
|
318
|
+
|
|
314
319
|
## 许可
|
|
315
320
|
|
|
316
321
|
MIT © dsh-usage-plugin
|
package/lib/client.js
CHANGED
|
@@ -21,7 +21,7 @@ window.__ModuleLoader__.load({
|
|
|
21
21
|
} catch (e3) {}
|
|
22
22
|
|
|
23
23
|
// ── i18n: zh keys → en dictionary (community addition) ──
|
|
24
|
-
var __T_EN = {"本期无消耗(所有用量为 0)":"No usage this turn (all zeros)","按模型":"By model","…及另外 ":"…plus "," 个模型(完整列表见「用量与消耗」页签)":" more models (full list in the Usage & Cost tab)","对话累计":"Conversation total","本轮明细":"This turn","本轮 token":"Turn tokens","本轮消耗":"Turn cost","本轮缓存命中率":"Turn hit rate","本轮耗时":"Turn duration","本轮无记录":"No records this turn","工具调用(内部)":"Tool calls (internal)"," 条内部调用":" internal calls","展开":"Expand","收起":"Collapse","详细记录请在「用量与消耗」页签查看":"Full details are in the Usage & Cost tab","获取中…":"Loading…","总 token":"Total tokens","Token 明细":"Token details","本次输出":"This output","总消耗":"Total cost","耗时":"Run time","缓存命中率":"Cache hit rate","关闭":"Close","无 Token 数据":"No token data","当前 · ":"Current · ","工作日高峰时段":"Weekday peak hours","工作日空闲时段":"Weekday off-peak hours","周末高峰时段":"Weekend peak hours","周末空闲时段":"Weekend off-peak hours","周一至周五 9:00–12:00、14:00–18:00":"Mon–Fri 9:00–12:00 & 14:00–18:00","工作日其余时间":"Other weekday hours","周末(周六、周日)全天按空闲价计费":"All weekend (Sat & Sun) billed at the off-peak rate","2026-08-23 前仍按原规则分峰谷":"Before 2026-08-23 the old peak/valley split still applies","高峰 / 空闲时段说明":"Peak / off-peak hours","工作日高峰":"Weekday peak","空闲时段":"Off-peak hours"," 周一至周五 9:00–12:00、14:00–18:00":" Mon–Fri 9:00–12:00 & 14:00–18:00"," 工作日其余时间,以及周末(周六、周日)全天(自 2026-08-23 起;此前仍按原规则分峰谷)":" Weekday off-peak hours, plus all weekend (Sat & Sun) since 2026-08-23 (before that, the old peak/valley split still applies)","工作日高峰 9:00–12:00、14:00–18:00 · 周末全天空闲价":"Weekday peak 9:00–12:00 & 14:00–18:00 · all-weekend off-peak rate","\n调用 ":"\ncalls ",")\n输入·未命中 ":")\ninput·miss ","\n高峰消耗 ":"\npeak cost ","\n无记录":"\nno records","自动模式:按调用时间自动选择计费档位——新价格表生效前的调用按基础价(旧价格表),生效后的调用按峰谷价(工作日高峰时段 9:00–12:00、14:00–18:00 用高峰价,其余时间——含周末全天——用空闲价)。当前显示:":"Auto mode: the billing tier is chosen automatically by call time — calls made before the new price schedule took effect are billed at base (old) prices; calls after it use peak/valley prices (weekday peak hours 9:00–12:00 & 14:00–18:00 at the peak price, all other times — including all weekend — at the off-peak price). Currently shown:","单位:元 / 百万 tokens。工作日高峰时段(北京时间 9:00–12:00、14:00–18:00)用高峰价,其余时间用空闲价(空闲价 = 高峰价的一半);自 2026-08-23 起周末(周六、周日)全天按空闲价计费,新规则生效前仍按原规则。概览、用量日历、缓存命中列表中的消耗均已按高峰 / 空闲分列统计。":"Unit: CNY per million tokens. Weekday peak hours (Beijing time 9:00–12:00 & 14:00–18:00) use the peak price; all other times use the off-peak price (off-peak = half of peak). Since 2026-08-23, weekends (Sat & Sun) are billed at the off-peak rate all day; calls before the new rule still follow the old split. Costs in Overview, Usage Calendar and the Cache Hit List are split into peak / off-peak accordingly.","未知模型":"Unknown model","未知服务商":"Unknown provider","完成":"Done","工具调用":"Tool call","超长":"Overlong","错误":"Error","自动(生效前基础价 · 生效后峰谷价)":"Auto (base price before effective date · peak/valley after)","基础价格":"Base price","峰谷价格":"Peak/valley price","自动":"Auto","canvas 2d 不可用":"canvas 2D unavailable","用量与消耗报告":"Usage & Cost Report","生成时间 ":"Generated ","(北京) · 共 ":" (Beijing) · total "," 条调用 · 缓存命中率 ":" calls · cache-hit rate "," · 高峰价消耗 ":" · peak-rate cost "," · 空闲价消耗 ":" · off-peak cost "," · 合计 ":" · total "," · 报告仅含最近 ":" · report limited to the latest "," 条":" records","调用次数":"Calls","输入 · 未命中":"Input · miss","输入 · 缓存命中":"Input · cache hit","输出":"Output","高峰消耗":"Peak cost","空闲消耗":"Off-peak cost","总消耗 (峰谷价)":"Total cost (peak/valley)","缓存命中列表(共 ":"Cache hit list ("," 条)":" records)","时间(北京)":"Time (Beijing)","模型":"Model","输入·未命中":"Input·miss","缓存命中":"Cache hit","缓存写入":"Cache write","推理":"Reasoning","命中率":"Hit rate","时段":"Period","结束":"End","消耗(峰谷)":"Cost (peak/valley)","峰":"Peak","谷":"Valley","消耗表(按模型 · 峰谷价 · 高峰/空闲分列)":"Cost table (by model · peak/valley prices)","调用":"Calls","总消耗":"Total cost","合计":"Total","消耗表(按 API 服务商 × 模型 · 峰谷价)":"Cost table (by API provider × model · peak/valley)","API 服务商 / 模型":"API provider / model"," 个模型)":" models)","总费用合计":"Total cost overall","计价按请求的 API 服务商分别应用已核验价格;DigitalOcean 美元价按 USD/CNY 汇率折算;无法可靠映射的第三方价格按 ¥0。":"Billing applies verified prices per requesting API provider; DigitalOcean USD prices are converted at the USD/CNY rate; third-party prices that cannot be mapped reliably are counted as ¥0."," 个服务商":" providers","今天":"Today","近7天":"Last 7 days","近30天":"Last 30 days","全部":"All","自定义区间:":"Custom range:","至":"to","清除筛选":"Clear filters","当前范围:共 ":"Current range: ","(全部记录)":"(all records)"," · 总消耗 ":" · total cost ","高峰 ":"Peak "," · 空闲 ":" · off-peak ","命中率 ":"hit rate ","高峰时段 9:00–12:00、14:00–18:00":"Peak hours 9:00–12:00 & 14:00–18:00","其余空闲时段":"other hours are off-peak","高峰 + 空闲 · ":"Peak + off-peak · ","消耗表(按模型)":"Cost table (by model)","API 服务商":"API provider","高峰/空闲":"Peak/Off-peak","消耗明细(按 API 服务商 × 模型)":"Cost breakdown (by API provider × model)","DeepSeek 官方请求按官方峰谷价;SiliconFlow 按自身人民币公开价;DigitalOcean 按美元公开价 × USD/CNY 汇率折算人民币;千问暂不计费;AMD GPU Cloud DeepSeek V4 Flash 免费按 ¥0。模型名与 API 服务商均以请求参数为准。":"DeepSeek official requests use official peak/valley prices; SiliconFlow uses its own public CNY prices; DigitalOcean uses public USD prices converted to CNY at the USD/CNY rate; Qwen is not billed yet; AMD GPU Cloud DeepSeek V4 Flash is free at ¥0. Model names and API providers follow the actual request parameters."," 次(高峰 ":" calls (peak "," / 空闲 ":" / off-peak "," · 缓存命中 ":" · cache hit "," · 输出 ":" · output "," · 推理 ":" · reasoning "," · 空闲消耗 ":" · off-peak cost ","‹ 上月":"‹ Prev month","下月 ›":"Next month ›","按消耗":"By cost","按调用数":"By calls","热力:":"Heatmap: ","低 → 高(":"low → high (","当日消耗":"Day cost","当日调用数":"Day calls","· 悬停查看详情,点击某天查看当日调用":"· hover for details, click a day for that day's calls","本月调用":"Calls this month","本月消耗":"Cost this month","本月暂无记录。":"No records this month.","日期":"Date","总消耗(自动)":"Total cost (auto)"," 调用明细":" call details"," 条 · ":" records · "," | 空闲 ":" | off-peak "," | 合计 ":" | total ","该日无记录。":"No records for this day.","消耗":"Cost","清除区间":"Clear range"," 条 · 输入·未命中 ":" records · input·miss "," · 缓存写入 ":" · cache write "," · 高峰消耗 ":" · peak cost ","该时间范围内没有记录。":"No records in this range.","‹ 上一页":"‹ Prev page","第 ":"Page "," 页 · 每页 ":" page · per page "," 条 · 共 ":" records · total ","下一页 ›":"Next page ›","新价格表生效时间未知":"New price schedule effective date unknown","新价格表(峰谷价)将于 ":"The new peak/valley price schedule takes effect ","(北京时间)生效,当前按旧价格表(基础价)计费":" (Beijing time); currently billing on the old base-price schedule","新价格表(峰谷价)已生效(自 ":"New peak/valley schedule in effect (since "," 起)":")","今日 $ / ¥ 汇率":"Today's $/¥ rate","暂不可用":"Temporarily unavailable","汇率日期 ":"Rate date ","等待获取":"Pending fetch","汇率状态":"Rate status","缓存汇率":"Cached rate","最新可用":"Latest available","获取失败":"Fetch failed","刷新汇率":"Refresh rate","美元计价的 DigitalOcean 消耗按该 USD/CNY 汇率换算成人民币;人民币定价不受汇率影响。":"USD-denominated DigitalOcean costs are converted to CNY at this rate; CNY pricing is unaffected by it.","DeepSeek 官方 API 价格表":"DeepSeek Official API Price Table","本表仅用于 DeepSeek 官方 Provider;第三方 Provider 按下方已核验的自身价格计费,无法可靠匹配价格的模型按 0 统计。价格按官方公布固定,不可编辑。":"This table applies only to the official DeepSeek provider; third-party providers bill at their own verified prices below, and models without a reliable price match are counted as 0. Prices are fixed as officially published and are not editable.","峰谷价":"Peak/valley","基础价":"Base","自动模式:按调用时间自动选择计费档位——新价格表生效前的调用按基础价(旧价格表),生效后的调用按峰谷价(高峰时段 9:00–12:00、14:00–18:00 用高峰价,其余空闲时段用空闲价)。当前显示:":"Auto mode: the billing tier is chosen automatically by call time — calls made before the new schedule took effect use base (old) prices, calls after it use peak/valley prices (peak hours 9:00–12:00 & 14:00–18:00 at peak price, other hours at off-peak). Currently shown:","基础价表(旧价格表,新价格生效前)":"Base price table (old schedule, before new prices take effect)","峰谷价表(新价格表)":"Peak/valley table (new schedule)","。价格按官方公布固定,不可编辑。":". Prices are fixed as officially published and are not editable.","缓存命中(输入)":"Cache hit (input)","空闲 · 缓存命中":"Off-peak · cache hit","空闲 · 输入":"Off-peak · input","空闲 · 输出":"Off-peak · output","高峰 · 缓存命中":"Peak · cache hit","高峰 · 输入":"Peak · input","高峰 · 输出":"Peak · output","单位:元 / 百万 tokens。高峰时段(北京时间 9:00–12:00、14:00–18:00)用高峰价,其余空闲时段用空闲价(空闲价 = 高峰价的一半)。概览、用量日历、缓存命中列表中的消耗均已按高峰 / 空闲分列统计。":"Unit: CNY per million tokens. Peak hours (Beijing 9:00–12:00 & 14:00–18:00) use peak prices; other hours use off-peak (= half of peak). Costs in Overview, Usage Calendar and Cache Hit List are split into peak / off-peak accordingly.","第三方平台价格与覆盖状态(2026-08-19 核验)":"Third-party platform prices & coverage (verified 2026-08-19)","只把能与记录中的 provider/model 可靠匹配的价格用于自动计费;美元价格先按 USD 计算,再乘 USD/CNY 汇率统一折算成人民币。":"Only prices that reliably match a record's provider/model are used for automatic billing; USD prices are computed in USD first, then converted to CNY at the USD/CNY rate.","模型 / 状态":"Model / status","输入":"Input","说明":"Notes","已用于自动计费":"Used for auto billing","缓存命中价按 2026-08-03 起生效公告":"Cache-hit price per the notice effective 2026-08-03","按输入价":"Billed at input price","公告未单列缓存命中价":"The notice lists no separate cache-hit price","自动按 USD/CNY 汇率换算人民币并计费":"Auto-converted to CNY at the USD/CNY rate and billed","Alibaba / 千问":"Alibaba / Qwen","暂不计费":"Not billed yet","调用与 token 正常统计;费用暂按 ¥0":"Calls and tokens tracked normally; cost counted as ¥0 for now","免费;费用固定按 ¥0":"Free; cost fixed at ¥0","DigitalOcean 使用美元官方价并按最新可用 USD/CNY 汇率折算人民币;千问暂不计费;AMD GPU Cloud 的 DeepSeek V4 Flash 免费按 ¥0。":"DigitalOcean bills at official USD prices converted via the latest available USD/CNY rate; Qwen is not billed yet; AMD GPU Cloud DeepSeek V4 Flash is free at ¥0.","概览":"Overview","用量日历":"Usage Calendar","缓存命中列表":"Cache Hit List","价格表":"Price Table","已导出:":"Exported: ","导出失败:":"Export failed: ","未知错误":"unknown error","导出中…":"Exporting…","生成图片中…":"Rendering image…","画布不可用":"Canvas unavailable","生成图片失败:":"Image rendering failed: ","打开目录选择…":"Open directory picker…","导出目标:":"Export destination:","选择目录失败:":"Failed to pick directory: ","打开文件夹失败:":"Failed to open folder: ","读取文件…":"Reading file…","导入成功:新增 ":"Import OK: added "," 条,跳过重复 ":", skipped duplicates "," 条,忽略无效 ":", ignored invalid "," 条,现有共 ":", total now ","导入失败:":"Import failed: ","读取文件失败":"Failed to read file","用量与消耗":"Usage & Cost","记录插件激活后的每一次模型调用":"Logs every model call since the plugin was activated","当前 · 高峰时段":"Current · peak hours","当前 · 空闲时段":"Current · off-peak hours","新价格已生效":"New prices in effect","新价格未生效":"New prices not yet in effect","刷新":"Refresh","清空":"Clear","计价说明:DeepSeek 官方与 SiliconFlow 按人民币价格;DigitalOcean 按美元官方价 × USD/CNY 汇率折算人民币;千问暂不计费;AMD GPU Cloud DeepSeek V4 Flash 免费按 ¥0。":"Billing notes: DeepSeek official and SiliconFlow bill in CNY; DigitalOcean bills at official USD prices × USD/CNY rate; Qwen is not billed yet; AMD GPU Cloud DeepSeek V4 Flash is free at ¥0.","导出 CSV":"Export CSV","导出 JSON":"Export JSON","导出图片 (PNG)":"Export image (PNG)","打开目录":"Open folder","导出目标目录(留空 = 默认数据目录)":"Export target directory (empty = default data dir)","选择目录…":"Choose directory…","已恢复默认数据目录":"Restored default data directory","重置":"Reset","选择文件导入":"Choose a file to import","数据持久化:":"Data persistence:","(每次调用实时落盘,插件重启后自动恢复,最多保留 100000 条)":"(every call is written to disk live, restored automatically after restart, up to 100000 records)","持久化未启用:":"Persistence disabled:","未知原因":"unknown reason","DEEPSEEK_API_KEY(推理 Key)":"DEEPSEEK_API_KEY (inference key)","模型设置中 Provider ID 或显示名为 siliconflow 的提供商 API Key":"API key of the provider whose Provider ID or display name is siliconflow in model settings","打开 SiliconFlow API 密钥":"Open SiliconFlow API keys","账户级 dop_v1_ Personal Access Token;Read Only(api:read)或 billing:read":"Account-level dop_v1_ Personal Access Token; Read Only (api:read) or billing:read","创建 DigitalOcean Account API Token":"Create a DigitalOcean account API token","暂无公开余额 API,仅支持控制台查看":"No public balance API yet — console only","打开 AMD Developer Cloud":"Open AMD Developer Cloud","查询失败":"Query failed","无法读取凭据状态":"Cannot read credential status","请输入以 dop_v1_ 开头的 DigitalOcean 账户 PAT。":"Enter a DigitalOcean account PAT starting with dop_v1_.","保存失败":"Save failed","使用凭据 ":"Using credential ","来源 ":"source ","模型提供商 ":"Model provider ","端点 ":"Endpoint "," · 账户余额":" · account balance","USD · 预付款/信用余额":"USD · prepaid/credit balance","USD · 待结算金额":"USD · pending amount","USD · 当前无余额":"USD · no balance"," · 账户可用":" · account available"," · 账户不可用":" · account unavailable"," · 查询成功":" · query succeeded","剩余余额查询":"Remaining balance query","查询 DeepSeek、SiliconFlow 与 DigitalOcean 账户余额":"Query DeepSeek, SiliconFlow and DigitalOcean account balances","打开控制台":"Open console","查询中…":"Querying…","查询账单":"Query billing","查询余额":"Query balance","所需凭据:":"Required credentials:","仅支持控制台查看":"Console only","插件不会尝试未经公开文档确认的端点,也不会把 AMD 推理 Key 当作账单凭据。":"The plugin never probes endpoints unconfirmed by public docs, and never uses AMD inference keys as billing credentials.","请确认凭据类型正确、权限包含余额/账单读取,且网络可访问服务商官方 API。":"Please verify the credential type is correct, its permissions include balance/billing read, and the provider's official API is reachable from this network.","打开服务商凭据页面":"Open provider credentials page","正在查询余额…":"Querying balance…","可用":"Available","不可用":"Unavailable","账单更新时间":"Billing updated","查询时间":"Queried at","北京时间":"Beijing time","请创建账户级 Personal Access Token。可选 Read Only(api:read,包含 billing:read),或自定义 billing:read;不要使用 Gradient AI 推理 Key。":"Please create an account-level Personal Access Token. Choose Read Only (api:read incl. billing:read) or a custom scope with billing:read; do not use a Gradient AI inference key.","正在检查已保存的 Token…":"Checking saved token…","已保存:":"Saved: ","(来源:":" (source: ","无法读取 Token 状态:":"Cannot read token status: ","尚未保存 DIGITALOCEAN_TOKEN。":"DIGITALOCEAN_TOKEN is not saved yet.","输入新的 dop_v1_ Token 可替换(当前值已隐藏)":"Enter a new dop_v1_ token to replace it (current value hidden)","保存中…":"Saving…","保存并查询":"Save & query","当前 Token 来自只读环境变量;请在原来源中修改,页面不会覆盖它。":"The current token comes from a read-only environment variable; edit it at its source — this panel will not overwrite it.","Token 已安全保存;页面和 API 响应不会回传明文。":"Token stored securely; neither the page nor API responses echo it back.","SiliconFlow 查询说明":"SiliconFlow query notes","公开 API 已成功返回 ¥0.00。SiliconFlow 的 /v1/user/info 当前不返回代金券或历史用量;控制台可用总额可能非零。这里忠实展示 API 原始余额字段,不把它等同于控制台完整额度。":"The public API returned ¥0.00 successfully. SiliconFlow's /v1/user/info currently returns no vouchers or historical usage; the console total may still be non-zero. The raw balance field from the API is shown faithfully here and should not be read as the full console credit.","余额卡片展示 SiliconFlow /v1/user/info 公开 API 返回的原始余额字段。":"The balance card shows the raw balance field returned by SiliconFlow's public /v1/user/info API.","返回字段":"Returned fields","凭据读取规则":"Credential lookup rules","插件只检查“设置 → 模型”中 Provider ID 或显示名为 siliconflow 的提供商,并读取其 apiKeyEnv 对应的已保存 API Key。":"The plugin only checks providers in Settings → Models whose Provider ID or display name is siliconflow, and reads the saved API key referenced by their apiKeyEnv.","如果未找到提供商、未填写 API Key 或凭据引用失效,插件会停止查询并说明需要修复的配置;不会回退到其他服务商的 Key。":"If no such provider exists, the key is empty, or the credential reference is broken, the plugin stops querying and explains what needs fixing; it never falls back to another provider's key.","DigitalOcean 查询的是主账户 Billing API;DigitalOcean AI 推理 Key 与 AMD GPU Cloud 推理 Key 均不能直接查询账单。":"DigitalOcean queries the main account Billing API; DigitalOcean AI inference keys and AMD GPU Cloud inference keys cannot query billing directly.","\n调用 ":"\ncalls ",")\n输入·未命中 ":")\ninput·miss ","\n高峰消耗 ":"\npeak cost ","\n无记录":"\nno records","查询 DeepSeek、SiliconFlow、DigitalOcean 与百炼 Token Plan":"Query DeepSeek, SiliconFlow, DigitalOcean & Bailian Token Plan balances","百炼 Token Plan · 1 周配额":"Bailian Token Plan · 1-week quota","百炼 Token Plan 配额用量":"Bailian Token Plan quota usage","百炼 Token Plan":"Bailian Token Plan","本周配额":"This week's quota","开始":"Start","结束":"End","已用 ":"Used ","百炼 Token Plan 查询说明":"Bailian Token Plan query notes","本查询复用百炼 CLI(bl)的“控制台登录”OAuth token,不需要阿里云 AccessKey,权限面很小。":"This query reuses the console-login OAuth token from the Bailian CLI (bl); no Alibaba Cloud AccessKey is needed and the permission scope is minimal.","如尚未登录,请先在终端执行:bl auth login --console,然后回到本页点“查询余额”。":"If you haven't logged in yet, run: bl auth login --console, then come back and click 'Query balance'.","打开百炼 CLI 登录说明":"Open Bailian CLI login docs","百炼控制台 OAuth 登录(~/.bailian/config.json 的 access_token,用 bl auth login --console 生成)":"Bailian console OAuth login (access_token in ~/.bailian/config.json, created by bl auth login --console)","数据来自阿里云百炼控制台内部门户网关(zeldaHttp.apikeyMgr./tokenplan/personal/api/v2/usage),展示的是 1 周配额已用进度与周期。":"Data from Alibaba Cloud Bailian console portal gateway (zeldaHttp.apikeyMgr./tokenplan/personal/api/v2/usage), showing 1-week quota usage progress and period."};
|
|
24
|
+
var __T_EN = {"本期无消耗(所有用量为 0)":"No usage this turn (all zeros)","按模型":"By model","…及另外 ":"…plus "," 个模型(完整列表见「用量与消耗」页签)":" more models (full list in the Usage & Cost tab)","对话累计":"Conversation total","本轮明细":"This turn","本轮 token":"Turn tokens","本轮消耗":"Turn cost","本轮缓存命中率":"Turn hit rate","本轮耗时":"Turn duration","本轮无记录":"No records this turn","工具调用(内部)":"Tool calls (internal)"," 条内部调用":" internal calls","展开":"Expand","收起":"Collapse","详细记录请在「用量与消耗」页签查看":"Full details are in the Usage & Cost tab","获取中…":"Loading…","总 token":"Total tokens","Token 明细":"Token details","本次输出":"This output","总消耗":"Total cost","耗时":"Run time","缓存命中率":"Cache hit rate","关闭":"Close","无 Token 数据":"No token data","当前 · ":"Current · ","工作日高峰时段":"Weekday peak hours","工作日空闲时段":"Weekday off-peak hours","周末高峰时段":"Weekend peak hours","周末空闲时段":"Weekend off-peak hours","周一至周五 9:00–12:00、14:00–18:00":"Mon–Fri 9:00–12:00 & 14:00–18:00","工作日其余时间":"Other weekday hours","周末(周六、周日)全天按空闲价计费":"All weekend (Sat & Sun) billed at the off-peak rate","2026-08-23 前仍按原规则分峰谷":"Before 2026-08-23 the old peak/valley split still applies","高峰 / 空闲时段说明":"Peak / off-peak hours","工作日高峰":"Weekday peak","空闲时段":"Off-peak hours"," 周一至周五 9:00–12:00、14:00–18:00":" Mon–Fri 9:00–12:00 & 14:00–18:00"," 工作日其余时间,以及周末(周六、周日)全天(自 2026-08-23 起;此前仍按原规则分峰谷)":" Weekday off-peak hours, plus all weekend (Sat & Sun) since 2026-08-23 (before that, the old peak/valley split still applies)","工作日高峰 9:00–12:00、14:00–18:00 · 周末全天空闲价":"Weekday peak 9:00–12:00 & 14:00–18:00 · all-weekend off-peak rate","\n调用 ":"\ncalls ",")\n输入·未命中 ":")\ninput·miss ","\n高峰消耗 ":"\npeak cost ","\n无记录":"\nno records","自动模式:按调用时间自动选择计费档位——新价格表生效前的调用按基础价(旧价格表),生效后的调用按峰谷价(工作日高峰时段 9:00–12:00、14:00–18:00 用高峰价,其余时间——含周末全天——用空闲价)。当前显示:":"Auto mode: the billing tier is chosen automatically by call time — calls made before the new price schedule took effect are billed at base (old) prices; calls after it use peak/valley prices (weekday peak hours 9:00–12:00 & 14:00–18:00 at the peak price, all other times — including all weekend — at the off-peak price). Currently shown:","单位:元 / 百万 tokens。工作日高峰时段(北京时间 9:00–12:00、14:00–18:00)用高峰价,其余时间用空闲价(空闲价 = 高峰价的一半);自 2026-08-23 起周末(周六、周日)全天按空闲价计费,新规则生效前仍按原规则。概览、用量日历、缓存命中列表中的消耗均已按高峰 / 空闲分列统计。":"Unit: CNY per million tokens. Weekday peak hours (Beijing time 9:00–12:00 & 14:00–18:00) use the peak price; all other times use the off-peak price (off-peak = half of peak). Since 2026-08-23, weekends (Sat & Sun) are billed at the off-peak rate all day; calls before the new rule still follow the old split. Costs in Overview, Usage Calendar and the Cache Hit List are split into peak / off-peak accordingly.","未知模型":"Unknown model","未知服务商":"Unknown provider","完成":"Done","工具调用":"Tool call","超长":"Overlong","错误":"Error","已中断":"Interrupted","超时":"Timeout","中断":"Interrupted"," · 中断 ":" · interrupted ","(未计费)":" (not billed)","本地统计与官方后台的差异":"Local stats vs official console","本面板统计的是插件在本地捕获的模型调用(按官方价格与峰谷时段计费)。与官方后台(platform.deepseek.com 用量页)相比,金额可能更低,常见原因:":"This panel shows calls captured locally by the plugin (billed at official prices with peak/off-peak rates). Compared with the official console (platform.deepseek.com usage page), the amount may be lower — common reasons:","① 中断/出错/超时的调用:官方仍按实际 token 计费,插件无法获取其用量,按 0 记录(明细中标「中断」);":"① Interrupted/failed/timed-out calls: the console still bills their actual tokens, but the plugin cannot obtain their usage, so they are recorded as 0 (marked \"Interrupted\" in details);","② 账号下其他 API Key(如其它应用/脚本)的调用不经过 DeepSeek Harness,官方统计包含它们,本插件不包含;":"② Calls from other API keys on your account (e.g. other apps/scripts) do not pass through DeepSeek Harness — the console includes them, this plugin does not;","③ 如需精确对账,可在官方用量页导出月度账单 CSV 与本插件对比。":"③ For exact reconciliation, export the monthly billing CSV from the official usage page and compare it with this plugin.","当前记录中有 ":"Current records include "," 次中断调用(未计费)——对应官方后台已计费的部分。":" interrupted call(s) (not billed) — corresponding to the part already billed by the official console.","自动(生效前基础价 · 生效后峰谷价)":"Auto (base price before effective date · peak/valley after)","基础价格":"Base price","峰谷价格":"Peak/valley price","自动":"Auto","canvas 2d 不可用":"canvas 2D unavailable","用量与消耗报告":"Usage & Cost Report","生成时间 ":"Generated ","(北京) · 共 ":" (Beijing) · total "," 条调用 · 缓存命中率 ":" calls · cache-hit rate "," · 高峰价消耗 ":" · peak-rate cost "," · 空闲价消耗 ":" · off-peak cost "," · 合计 ":" · total "," · 报告仅含最近 ":" · report limited to the latest "," 条":" records","调用次数":"Calls","输入 · 未命中":"Input · miss","输入 · 缓存命中":"Input · cache hit","输出":"Output","高峰消耗":"Peak cost","空闲消耗":"Off-peak cost","总消耗 (峰谷价)":"Total cost (peak/valley)","缓存命中列表(共 ":"Cache hit list ("," 条)":" records)","时间(北京)":"Time (Beijing)","模型":"Model","输入·未命中":"Input·miss","缓存命中":"Cache hit","缓存写入":"Cache write","推理":"Reasoning","命中率":"Hit rate","时段":"Period","结束":"End","消耗(峰谷)":"Cost (peak/valley)","峰":"Peak","谷":"Valley","消耗表(按模型 · 峰谷价 · 高峰/空闲分列)":"Cost table (by model · peak/valley prices)","调用":"Calls","总消耗":"Total cost","合计":"Total","消耗表(按 API 服务商 × 模型 · 峰谷价)":"Cost table (by API provider × model · peak/valley)","API 服务商 / 模型":"API provider / model"," 个模型)":" models)","总费用合计":"Total cost overall","计价按请求的 API 服务商分别应用已核验价格;DigitalOcean 美元价按 USD/CNY 汇率折算;无法可靠映射的第三方价格按 ¥0。":"Billing applies verified prices per requesting API provider; DigitalOcean USD prices are converted at the USD/CNY rate; third-party prices that cannot be mapped reliably are counted as ¥0."," 个服务商":" providers","今天":"Today","近7天":"Last 7 days","近30天":"Last 30 days","全部":"All","自定义区间:":"Custom range:","至":"to","清除筛选":"Clear filters","当前范围:共 ":"Current range: ","(全部记录)":"(all records)"," · 总消耗 ":" · total cost ","高峰 ":"Peak "," · 空闲 ":" · off-peak ","命中率 ":"hit rate ","高峰时段 9:00–12:00、14:00–18:00":"Peak hours 9:00–12:00 & 14:00–18:00","其余空闲时段":"other hours are off-peak","高峰 + 空闲 · ":"Peak + off-peak · ","消耗表(按模型)":"Cost table (by model)","API 服务商":"API provider","高峰/空闲":"Peak/Off-peak","消耗明细(按 API 服务商 × 模型)":"Cost breakdown (by API provider × model)","DeepSeek 官方请求按官方峰谷价;SiliconFlow 按自身人民币公开价;DigitalOcean 按美元公开价 × USD/CNY 汇率折算人民币;千问暂不计费;AMD GPU Cloud DeepSeek V4 Flash 免费按 ¥0。模型名与 API 服务商均以请求参数为准。":"DeepSeek official requests use official peak/valley prices; SiliconFlow uses its own public CNY prices; DigitalOcean uses public USD prices converted to CNY at the USD/CNY rate; Qwen is not billed yet; AMD GPU Cloud DeepSeek V4 Flash is free at ¥0. Model names and API providers follow the actual request parameters."," 次(高峰 ":" calls (peak "," / 空闲 ":" / off-peak "," · 缓存命中 ":" · cache hit "," · 输出 ":" · output "," · 推理 ":" · reasoning "," · 空闲消耗 ":" · off-peak cost ","‹ 上月":"‹ Prev month","下月 ›":"Next month ›","按消耗":"By cost","按调用数":"By calls","热力:":"Heatmap: ","低 → 高(":"low → high (","当日消耗":"Day cost","当日调用数":"Day calls","· 悬停查看详情,点击某天查看当日调用":"· hover for details, click a day for that day's calls","本月调用":"Calls this month","本月消耗":"Cost this month","本月暂无记录。":"No records this month.","日期":"Date","总消耗(自动)":"Total cost (auto)"," 调用明细":" call details"," 条 · ":" records · "," | 空闲 ":" | off-peak "," | 合计 ":" | total ","该日无记录。":"No records for this day.","消耗":"Cost","清除区间":"Clear range"," 条 · 输入·未命中 ":" records · input·miss "," · 缓存写入 ":" · cache write "," · 高峰消耗 ":" · peak cost ","该时间范围内没有记录。":"No records in this range.","‹ 上一页":"‹ Prev page","第 ":"Page "," 页 · 每页 ":" page · per page "," 条 · 共 ":" records · total ","下一页 ›":"Next page ›","新价格表生效时间未知":"New price schedule effective date unknown","新价格表(峰谷价)将于 ":"The new peak/valley price schedule takes effect ","(北京时间)生效,当前按旧价格表(基础价)计费":" (Beijing time); currently billing on the old base-price schedule","新价格表(峰谷价)已生效(自 ":"New peak/valley schedule in effect (since "," 起)":")","今日 $ / ¥ 汇率":"Today's $/¥ rate","暂不可用":"Temporarily unavailable","汇率日期 ":"Rate date ","等待获取":"Pending fetch","汇率状态":"Rate status","缓存汇率":"Cached rate","最新可用":"Latest available","获取失败":"Fetch failed","刷新汇率":"Refresh rate","美元计价的 DigitalOcean 消耗按该 USD/CNY 汇率换算成人民币;人民币定价不受汇率影响。":"USD-denominated DigitalOcean costs are converted to CNY at this rate; CNY pricing is unaffected by it.","DeepSeek 官方 API 价格表":"DeepSeek Official API Price Table","本表仅用于 DeepSeek 官方 Provider;第三方 Provider 按下方已核验的自身价格计费,无法可靠匹配价格的模型按 0 统计。价格按官方公布固定,不可编辑。":"This table applies only to the official DeepSeek provider; third-party providers bill at their own verified prices below, and models without a reliable price match are counted as 0. Prices are fixed as officially published and are not editable.","峰谷价":"Peak/valley","基础价":"Base","自动模式:按调用时间自动选择计费档位——新价格表生效前的调用按基础价(旧价格表),生效后的调用按峰谷价(高峰时段 9:00–12:00、14:00–18:00 用高峰价,其余空闲时段用空闲价)。当前显示:":"Auto mode: the billing tier is chosen automatically by call time — calls made before the new schedule took effect use base (old) prices, calls after it use peak/valley prices (peak hours 9:00–12:00 & 14:00–18:00 at peak price, other hours at off-peak). Currently shown:","基础价表(旧价格表,新价格生效前)":"Base price table (old schedule, before new prices take effect)","峰谷价表(新价格表)":"Peak/valley table (new schedule)","。价格按官方公布固定,不可编辑。":". Prices are fixed as officially published and are not editable.","缓存命中(输入)":"Cache hit (input)","空闲 · 缓存命中":"Off-peak · cache hit","空闲 · 输入":"Off-peak · input","空闲 · 输出":"Off-peak · output","高峰 · 缓存命中":"Peak · cache hit","高峰 · 输入":"Peak · input","高峰 · 输出":"Peak · output","单位:元 / 百万 tokens。高峰时段(北京时间 9:00–12:00、14:00–18:00)用高峰价,其余空闲时段用空闲价(空闲价 = 高峰价的一半)。概览、用量日历、缓存命中列表中的消耗均已按高峰 / 空闲分列统计。":"Unit: CNY per million tokens. Peak hours (Beijing 9:00–12:00 & 14:00–18:00) use peak prices; other hours use off-peak (= half of peak). Costs in Overview, Usage Calendar and Cache Hit List are split into peak / off-peak accordingly.","第三方平台价格与覆盖状态(2026-08-19 核验)":"Third-party platform prices & coverage (verified 2026-08-19)","只把能与记录中的 provider/model 可靠匹配的价格用于自动计费;美元价格先按 USD 计算,再乘 USD/CNY 汇率统一折算成人民币。":"Only prices that reliably match a record's provider/model are used for automatic billing; USD prices are computed in USD first, then converted to CNY at the USD/CNY rate.","模型 / 状态":"Model / status","输入":"Input","说明":"Notes","已用于自动计费":"Used for auto billing","缓存命中价按 2026-08-03 起生效公告":"Cache-hit price per the notice effective 2026-08-03","按输入价":"Billed at input price","公告未单列缓存命中价":"The notice lists no separate cache-hit price","自动按 USD/CNY 汇率换算人民币并计费":"Auto-converted to CNY at the USD/CNY rate and billed","Alibaba / 千问":"Alibaba / Qwen","暂不计费":"Not billed yet","调用与 token 正常统计;费用暂按 ¥0":"Calls and tokens tracked normally; cost counted as ¥0 for now","免费;费用固定按 ¥0":"Free; cost fixed at ¥0","DigitalOcean 使用美元官方价并按最新可用 USD/CNY 汇率折算人民币;千问暂不计费;AMD GPU Cloud 的 DeepSeek V4 Flash 免费按 ¥0。":"DigitalOcean bills at official USD prices converted via the latest available USD/CNY rate; Qwen is not billed yet; AMD GPU Cloud DeepSeek V4 Flash is free at ¥0.","概览":"Overview","用量日历":"Usage Calendar","缓存命中列表":"Cache Hit List","价格表":"Price Table","已导出:":"Exported: ","导出失败:":"Export failed: ","未知错误":"unknown error","导出中…":"Exporting…","生成图片中…":"Rendering image…","画布不可用":"Canvas unavailable","生成图片失败:":"Image rendering failed: ","打开目录选择…":"Open directory picker…","导出目标:":"Export destination:","选择目录失败:":"Failed to pick directory: ","打开文件夹失败:":"Failed to open folder: ","读取文件…":"Reading file…","导入成功:新增 ":"Import OK: added "," 条,跳过重复 ":", skipped duplicates "," 条,忽略无效 ":", ignored invalid "," 条,现有共 ":", total now ","导入失败:":"Import failed: ","读取文件失败":"Failed to read file","用量与消耗":"Usage & Cost","记录插件激活后的每一次模型调用":"Logs every model call since the plugin was activated","当前 · 高峰时段":"Current · peak hours","当前 · 空闲时段":"Current · off-peak hours","新价格已生效":"New prices in effect","新价格未生效":"New prices not yet in effect","刷新":"Refresh","清空":"Clear","计价说明:DeepSeek 官方与 SiliconFlow 按人民币价格;DigitalOcean 按美元官方价 × USD/CNY 汇率折算人民币;千问暂不计费;AMD GPU Cloud DeepSeek V4 Flash 免费按 ¥0。":"Billing notes: DeepSeek official and SiliconFlow bill in CNY; DigitalOcean bills at official USD prices × USD/CNY rate; Qwen is not billed yet; AMD GPU Cloud DeepSeek V4 Flash is free at ¥0.","导出 CSV":"Export CSV","导出 JSON":"Export JSON","导出图片 (PNG)":"Export image (PNG)","打开目录":"Open folder","导出目标目录(留空 = 默认数据目录)":"Export target directory (empty = default data dir)","选择目录…":"Choose directory…","已恢复默认数据目录":"Restored default data directory","重置":"Reset","选择文件导入":"Choose a file to import","数据持久化:":"Data persistence:","(每次调用实时落盘,插件重启后自动恢复,最多保留 100000 条)":"(every call is written to disk live, restored automatically after restart, up to 100000 records)","持久化未启用:":"Persistence disabled:","未知原因":"unknown reason","DEEPSEEK_API_KEY(推理 Key)":"DEEPSEEK_API_KEY (inference key)","模型设置中 Provider ID 或显示名为 siliconflow 的提供商 API Key":"API key of the provider whose Provider ID or display name is siliconflow in model settings","打开 SiliconFlow API 密钥":"Open SiliconFlow API keys","账户级 dop_v1_ Personal Access Token;Read Only(api:read)或 billing:read":"Account-level dop_v1_ Personal Access Token; Read Only (api:read) or billing:read","创建 DigitalOcean Account API Token":"Create a DigitalOcean account API token","暂无公开余额 API,仅支持控制台查看":"No public balance API yet — console only","打开 AMD Developer Cloud":"Open AMD Developer Cloud","查询失败":"Query failed","无法读取凭据状态":"Cannot read credential status","请输入以 dop_v1_ 开头的 DigitalOcean 账户 PAT。":"Enter a DigitalOcean account PAT starting with dop_v1_.","保存失败":"Save failed","使用凭据 ":"Using credential ","来源 ":"source ","模型提供商 ":"Model provider ","端点 ":"Endpoint "," · 账户余额":" · account balance","USD · 预付款/信用余额":"USD · prepaid/credit balance","USD · 待结算金额":"USD · pending amount","USD · 当前无余额":"USD · no balance"," · 账户可用":" · account available"," · 账户不可用":" · account unavailable"," · 查询成功":" · query succeeded","剩余余额查询":"Remaining balance query","查询 DeepSeek、SiliconFlow 与 DigitalOcean 账户余额":"Query DeepSeek, SiliconFlow and DigitalOcean account balances","打开控制台":"Open console","查询中…":"Querying…","查询账单":"Query billing","查询余额":"Query balance","所需凭据:":"Required credentials:","仅支持控制台查看":"Console only","插件不会尝试未经公开文档确认的端点,也不会把 AMD 推理 Key 当作账单凭据。":"The plugin never probes endpoints unconfirmed by public docs, and never uses AMD inference keys as billing credentials.","请确认凭据类型正确、权限包含余额/账单读取,且网络可访问服务商官方 API。":"Please verify the credential type is correct, its permissions include balance/billing read, and the provider's official API is reachable from this network.","打开服务商凭据页面":"Open provider credentials page","正在查询余额…":"Querying balance…","可用":"Available","不可用":"Unavailable","账单更新时间":"Billing updated","查询时间":"Queried at","北京时间":"Beijing time","请创建账户级 Personal Access Token。可选 Read Only(api:read,包含 billing:read),或自定义 billing:read;不要使用 Gradient AI 推理 Key。":"Please create an account-level Personal Access Token. Choose Read Only (api:read incl. billing:read) or a custom scope with billing:read; do not use a Gradient AI inference key.","正在检查已保存的 Token…":"Checking saved token…","已保存:":"Saved: ","(来源:":" (source: ","无法读取 Token 状态:":"Cannot read token status: ","尚未保存 DIGITALOCEAN_TOKEN。":"DIGITALOCEAN_TOKEN is not saved yet.","输入新的 dop_v1_ Token 可替换(当前值已隐藏)":"Enter a new dop_v1_ token to replace it (current value hidden)","保存中…":"Saving…","保存并查询":"Save & query","当前 Token 来自只读环境变量;请在原来源中修改,页面不会覆盖它。":"The current token comes from a read-only environment variable; edit it at its source — this panel will not overwrite it.","Token 已安全保存;页面和 API 响应不会回传明文。":"Token stored securely; neither the page nor API responses echo it back.","SiliconFlow 查询说明":"SiliconFlow query notes","公开 API 已成功返回 ¥0.00。SiliconFlow 的 /v1/user/info 当前不返回代金券或历史用量;控制台可用总额可能非零。这里忠实展示 API 原始余额字段,不把它等同于控制台完整额度。":"The public API returned ¥0.00 successfully. SiliconFlow's /v1/user/info currently returns no vouchers or historical usage; the console total may still be non-zero. The raw balance field from the API is shown faithfully here and should not be read as the full console credit.","余额卡片展示 SiliconFlow /v1/user/info 公开 API 返回的原始余额字段。":"The balance card shows the raw balance field returned by SiliconFlow's public /v1/user/info API.","返回字段":"Returned fields","凭据读取规则":"Credential lookup rules","插件只检查“设置 → 模型”中 Provider ID 或显示名为 siliconflow 的提供商,并读取其 apiKeyEnv 对应的已保存 API Key。":"The plugin only checks providers in Settings → Models whose Provider ID or display name is siliconflow, and reads the saved API key referenced by their apiKeyEnv.","如果未找到提供商、未填写 API Key 或凭据引用失效,插件会停止查询并说明需要修复的配置;不会回退到其他服务商的 Key。":"If no such provider exists, the key is empty, or the credential reference is broken, the plugin stops querying and explains what needs fixing; it never falls back to another provider's key.","DigitalOcean 查询的是主账户 Billing API;DigitalOcean AI 推理 Key 与 AMD GPU Cloud 推理 Key 均不能直接查询账单。":"DigitalOcean queries the main account Billing API; DigitalOcean AI inference keys and AMD GPU Cloud inference keys cannot query billing directly.","\n调用 ":"\ncalls ",")\n输入·未命中 ":")\ninput·miss ","\n高峰消耗 ":"\npeak cost ","\n无记录":"\nno records","查询 DeepSeek、SiliconFlow、DigitalOcean 与百炼 Token Plan":"Query DeepSeek, SiliconFlow, DigitalOcean & Bailian Token Plan balances","百炼 Token Plan · 1 周配额":"Bailian Token Plan · 1-week quota","百炼 Token Plan 配额用量":"Bailian Token Plan quota usage","百炼 Token Plan":"Bailian Token Plan","本周配额":"This week's quota","开始":"Start","结束":"End","已用 ":"Used ","百炼 Token Plan 查询说明":"Bailian Token Plan query notes","本查询复用百炼 CLI(bl)的“控制台登录”OAuth token,不需要阿里云 AccessKey,权限面很小。":"This query reuses the console-login OAuth token from the Bailian CLI (bl); no Alibaba Cloud AccessKey is needed and the permission scope is minimal.","如尚未登录,请先在终端执行:bl auth login --console,然后回到本页点“查询余额”。":"If you haven't logged in yet, run: bl auth login --console, then come back and click 'Query balance'.","打开百炼 CLI 登录说明":"Open Bailian CLI login docs","百炼控制台 OAuth 登录(~/.bailian/config.json 的 access_token,用 bl auth login --console 生成)":"Bailian console OAuth login (access_token in ~/.bailian/config.json, created by bl auth login --console)","数据来自阿里云百炼控制台内部门户网关(zeldaHttp.apikeyMgr./tokenplan/personal/api/v2/usage),展示的是 1 周配额已用进度与周期。":"Data from Alibaba Cloud Bailian console portal gateway (zeldaHttp.apikeyMgr./tokenplan/personal/api/v2/usage), showing 1-week quota usage progress and period."};
|
|
25
25
|
|
|
26
26
|
function __detectLang() {
|
|
27
27
|
// 语言完全跟随宿主设置(通用设置 → 语言):不再读 localStorage,避免旧选择覆盖系统语言
|
|
@@ -186,6 +186,7 @@ window.__ModuleLoader__.load({
|
|
|
186
186
|
badgeHit: { display: "inline-block", padding: "2px 8px", borderRadius: 999, fontSize: fs(11), fontWeight: 500, background: "rgba(46,204,113,.18)", color: "#2ecc71", whiteSpace: "nowrap" },
|
|
187
187
|
badgePeak: { display: "inline-block", padding: "2px 8px", borderRadius: 999, fontSize: fs(11), fontWeight: 500, background: "rgba(255,152,0,.18)", color: "#ff9800", whiteSpace: "nowrap" },
|
|
188
188
|
badgeValley: { display: "inline-block", padding: "2px 8px", borderRadius: 999, fontSize: fs(11), fontWeight: 500, background: "rgba(90,140,255,.18)", color: "#5a8cff", whiteSpace: "nowrap" },
|
|
189
|
+
badgeWarn: { display: "inline-block", padding: "2px 8px", borderRadius: 999, fontSize: fs(11), fontWeight: 500, background: "rgba(231,76,60,.16)", color: "#e74c3c", whiteSpace: "nowrap" },
|
|
189
190
|
costPeak: { color: "#e08700", fontWeight: 600, whiteSpace: "nowrap" },
|
|
190
191
|
costOff: { color: "#3d6bd6", fontWeight: 600, whiteSpace: "nowrap" },
|
|
191
192
|
err: { color: "#ff6b6b", fontSize: fs(12) },
|
|
@@ -193,6 +194,10 @@ window.__ModuleLoader__.load({
|
|
|
193
194
|
note: { fontSize: fs(11), opacity: 0.55 },
|
|
194
195
|
errbox: { border: "1px solid rgba(255,107,107,.4)", background: "rgba(255,107,107,.08)", borderRadius: 8, padding: 12, fontSize: fs(12) },
|
|
195
196
|
errboxTitle: { fontWeight: 600, marginBottom: 4, color: "#ff6b6b" },
|
|
197
|
+
diffbox: { border: "1px solid rgba(255,152,0,.4)", background: "rgba(255,152,0,.07)", borderRadius: 8, padding: "8px 12px", marginTop: 10, fontSize: fs(11), lineHeight: 1.6, color: "inherit" },
|
|
198
|
+
diffboxTitle: { fontWeight: 600, marginBottom: 4, color: "#e08700" },
|
|
199
|
+
diffboxText: { opacity: 0.85, marginBottom: 2 },
|
|
200
|
+
diffboxWarn: { marginTop: 6, color: "#e74c3c", fontWeight: 600 },
|
|
196
201
|
infobox: { border: "1px solid rgba(90,140,255,.35)", background: "rgba(90,140,255,.08)", borderRadius: 8, padding: 12, marginTop: 18, fontSize: fs(12) },
|
|
197
202
|
infoboxTitle: { fontWeight: 600, marginBottom: 4, color: "#5a8cff" },
|
|
198
203
|
actionLink: { display: "inline-block", marginTop: 8, color: "#3d6bd6", textDecoration: "underline", fontSize: fs(12) },
|
|
@@ -293,7 +298,7 @@ window.__ModuleLoader__.load({
|
|
|
293
298
|
var s = String(p == null ? "" : p).trim();
|
|
294
299
|
return s ? s.toLowerCase() : "unknown";
|
|
295
300
|
};
|
|
296
|
-
var finishLabel = function (f) { if (f === "stop") return t("完成"); if (f === "tool-calls") return t("工具调用"); if (f === "max-tokens") return t("超长"); if (f === "error") return t("错误"); return f || "—"; };
|
|
301
|
+
var finishLabel = function (f) { if (f === "stop") return t("完成"); if (f === "tool-calls") return t("工具调用"); if (f === "max-tokens") return t("超长"); if (f === "error") return t("错误"); if (f === "aborted") return t("已中断"); if (f === "timeout") return t("超时"); return f || "—"; };
|
|
297
302
|
var pct = function (a, b) { return b > 0 ? (a / b * 100).toFixed(1) + "%" : "—"; };
|
|
298
303
|
// 周末统一按空闲价规则生效时间:北京时间 2026-08-23 00:00(周日)。此前(含周末)仍按原峰谷分段。
|
|
299
304
|
var WEEKEND_FLAT_AT = Date.parse("2026-08-23T00:00:00+08:00");
|
|
@@ -542,10 +547,12 @@ var api = function (payload) {
|
|
|
542
547
|
for (var r3 = 0; r3 < count; r3++) {
|
|
543
548
|
var rec = records[r3];
|
|
544
549
|
var hit = rec.cacheReadTokens || 0, miss = rec.inputTokens || 0, cost = rec.peakValleyCost || 0;
|
|
550
|
+
var intR = !!rec.interrupted;
|
|
545
551
|
ctx.fillStyle = r3 % 2 === 1 ? "#fafbfc" : "#ffffff"; ctx.fillRect(P, y, W - 2 * P, rowH);
|
|
546
552
|
var ty = y + Math.round(rowH * 0.68);
|
|
547
553
|
ctx.textAlign = "left"; ctx.fillStyle = "#1c2733"; font(fBase, "400");
|
|
548
554
|
ctx.fillText(fmtTime(rec.time), c1.time, ty); ctx.fillText(modelName(rec), c1.model, ty);
|
|
555
|
+
if (intR) { ctx.fillStyle = "#e74c3c"; ctx.fillText(t("中断"), c1.model + ctx.measureText(modelName(rec)).width + 12, ty); ctx.fillStyle = "#1c2733"; }
|
|
549
556
|
ctx.textAlign = "right";
|
|
550
557
|
ctx.fillText(fmtInt(miss), c1.missR, ty);
|
|
551
558
|
ctx.fillStyle = "#22a45d"; ctx.fillText(fmtInt(hit), c1.hitR, ty);
|
|
@@ -557,8 +564,8 @@ var api = function (payload) {
|
|
|
557
564
|
ctx.fillText(rec.reasoningTokens ? fmtInt(rec.reasoningTokens) : "—", c1.reasonR, ty);
|
|
558
565
|
ctx.fillStyle = "#55617a"; ctx.fillText(pct(hit, hit + miss), c1.rateR, ty);
|
|
559
566
|
ctx.fillStyle = rec.peak ? "#e08700" : "#3d6bd6"; ctx.fillText(rec.peak ? t("峰") : t("谷"), c1.periodR, ty);
|
|
560
|
-
ctx.fillStyle = "#55617a"; ctx.fillText(finishLabel(rec.finishReason), c1.endR, ty);
|
|
561
|
-
ctx.fillStyle = rec.peak ? "#e08700" : "#3d6bd6"; ctx.fillText(fmtMoney(cost), c1.costR, ty);
|
|
567
|
+
ctx.fillStyle = intR ? "#e74c3c" : "#55617a"; ctx.fillText(finishLabel(rec.finishReason), c1.endR, ty);
|
|
568
|
+
ctx.fillStyle = rec.peak ? "#e08700" : "#3d6bd6"; ctx.fillText(intR ? "—" : fmtMoney(cost), c1.costR, ty);
|
|
562
569
|
y += rowH;
|
|
563
570
|
}
|
|
564
571
|
|
|
@@ -679,10 +686,12 @@ var api = function (payload) {
|
|
|
679
686
|
records.push(fr);
|
|
680
687
|
}
|
|
681
688
|
var totalCalls = records.length;
|
|
689
|
+
var totalInterrupted = 0;
|
|
682
690
|
var totalHit = 0, totalMiss = 0, totalWrite = 0, totalOut = 0, totalReason = 0, totalCost = 0, peakTotal = 0, offTotal = 0, peakCalls = 0, offCalls = 0;
|
|
683
691
|
var byModel = {}, byProvider = {}, byProviderModel = {};
|
|
684
692
|
for (var i = 0; i < records.length; i++) {
|
|
685
693
|
var r = records[i];
|
|
694
|
+
if (r.interrupted) totalInterrupted += 1;
|
|
686
695
|
totalHit += r.cacheReadTokens || 0; totalMiss += r.inputTokens || 0; totalWrite += r.cacheWriteTokens || 0;
|
|
687
696
|
totalOut += r.outputTokens || 0; totalReason += r.reasoningTokens || 0;
|
|
688
697
|
var cost = costOf(r, regime);
|
|
@@ -820,7 +829,7 @@ var api = function (payload) {
|
|
|
820
829
|
t("当前范围:共 ") + fmtInt(records.length) + t(" 条") + (preset === "all" && !fromDate && !toDate ? t("(全部记录)") : "") + t(" · 总消耗 ") + fmtMoney(totalCost) + "(" + costHint(regime) + ")"
|
|
821
830
|
),
|
|
822
831
|
el("div", { style: st.cards },
|
|
823
|
-
el(Card, { label: t("调用次数"), value: fmtInt(totalCalls), hint: t("高峰 ") + fmtInt(peakCalls) + t(" · 空闲 ") + fmtInt(offCalls) }),
|
|
832
|
+
el(Card, { label: t("调用次数"), value: fmtInt(totalCalls), hint: t("高峰 ") + fmtInt(peakCalls) + t(" · 空闲 ") + fmtInt(offCalls) + (totalInterrupted > 0 ? t(" · 中断 ") + fmtInt(totalInterrupted) + t("(未计费)") : "") }),
|
|
824
833
|
el(Card, { label: t("输入 · 未命中"), value: fmtInt(totalMiss), hint: "token" }),
|
|
825
834
|
el(Card, { label: t("输入 · 缓存命中"), value: fmtInt(totalHit), hint: t("命中率 ") + hitRate }),
|
|
826
835
|
el(Card, { label: t("输出"), value: fmtInt(totalOut), hint: "token" }),
|
|
@@ -1080,10 +1089,11 @@ var api = function (payload) {
|
|
|
1080
1089
|
el("tbody", null, selRecords.map(function (rr) {
|
|
1081
1090
|
var hit2 = rr.cacheReadTokens || 0, miss2 = rr.inputTokens || 0;
|
|
1082
1091
|
var cost2 = costOf(rr, regime);
|
|
1092
|
+
var int2 = !!rr.interrupted;
|
|
1083
1093
|
return el("tr", { key: rr.time },
|
|
1084
1094
|
el("td", { style: st.tdFirst }, fmtTime(rr.time)),
|
|
1085
1095
|
el("td", { style: st.tdWrap },
|
|
1086
|
-
el("div", null, modelName(rr)),
|
|
1096
|
+
el("div", null, modelName(rr), int2 ? el("span", { style: st.badgeWarn, marginLeft: 6 }, t("中断")) : null),
|
|
1087
1097
|
el("div", { style: st.sub }, providerName(rr.provider))
|
|
1088
1098
|
),
|
|
1089
1099
|
el("td", { style: st.td }, fmtInt(miss2)),
|
|
@@ -1091,8 +1101,8 @@ var api = function (payload) {
|
|
|
1091
1101
|
el("td", { style: st.td }, fmtInt(rr.outputTokens || 0)),
|
|
1092
1102
|
el("td", { style: st.td }, rr.reasoningTokens ? fmtInt(rr.reasoningTokens) : "—"),
|
|
1093
1103
|
el("td", { style: st.td }, rr.peak ? el("span", { style: st.badgePeak }, t("峰")) : el("span", { style: st.badgeValley }, t("谷"))),
|
|
1094
|
-
el("td", { style: st.td }, finishLabel(rr.finishReason)),
|
|
1095
|
-
el("td", { style: st.td }, el("span", { style: rr.peak ? st.costPeak : st.costOff }, fmtMoney(cost2)))
|
|
1104
|
+
el("td", { style: st.td }, int2 ? el("span", { style: st.badgeWarn }, finishLabel(rr.finishReason)) : finishLabel(rr.finishReason)),
|
|
1105
|
+
el("td", { style: st.td }, int2 ? el("span", { style: st.costOff }, "—") : el("span", { style: rr.peak ? st.costPeak : st.costOff }, fmtMoney(cost2)))
|
|
1096
1106
|
);
|
|
1097
1107
|
}))
|
|
1098
1108
|
)
|
|
@@ -1193,10 +1203,11 @@ var api = function (payload) {
|
|
|
1193
1203
|
pageRows.map(function (rr3, idx) {
|
|
1194
1204
|
var hit3 = rr3.cacheReadTokens || 0, miss3 = rr3.inputTokens || 0;
|
|
1195
1205
|
var cost3 = costOf(rr3, regime);
|
|
1206
|
+
var int3 = !!rr3.interrupted;
|
|
1196
1207
|
return el("tr", { key: rr3.time + "-" + idx },
|
|
1197
1208
|
el("td", { style: st.tdFirst }, fmtTime(rr3.time)),
|
|
1198
1209
|
el("td", { style: st.tdWrap },
|
|
1199
|
-
el("div", null, modelName(rr3)),
|
|
1210
|
+
el("div", null, modelName(rr3), int3 ? el("span", { style: st.badgeWarn, marginLeft: 6 }, t("中断")) : null),
|
|
1200
1211
|
el("div", { style: st.sub }, (rr3.provider || "") + (rr3.purpose ? " · " + rr3.purpose : ""))
|
|
1201
1212
|
),
|
|
1202
1213
|
el("td", { style: st.td }, fmtInt(miss3)),
|
|
@@ -1206,8 +1217,8 @@ var api = function (payload) {
|
|
|
1206
1217
|
el("td", { style: st.td }, rr3.reasoningTokens ? fmtInt(rr3.reasoningTokens) : "—"),
|
|
1207
1218
|
el("td", { style: st.td }, pct(hit3, hit3 + miss3)),
|
|
1208
1219
|
el("td", { style: st.td }, rr3.peak ? el("span", { style: st.badgePeak }, t("峰")) : el("span", { style: st.badgeValley }, t("谷"))),
|
|
1209
|
-
el("td", { style: st.td }, finishLabel(rr3.finishReason)),
|
|
1210
|
-
el("td", { style: st.td }, el("span", { style: rr3.peak ? st.costPeak : st.costOff }, fmtMoney(cost3)))
|
|
1220
|
+
el("td", { style: st.td }, int3 ? el("span", { style: st.badgeWarn }, finishLabel(rr3.finishReason)) : finishLabel(rr3.finishReason)),
|
|
1221
|
+
el("td", { style: st.td }, int3 ? el("span", { style: st.costOff }, "—") : el("span", { style: rr3.peak ? st.costPeak : st.costOff }, fmtMoney(cost3)))
|
|
1211
1222
|
);
|
|
1212
1223
|
}),
|
|
1213
1224
|
el("tr", null,
|
|
@@ -1473,6 +1484,8 @@ var api = function (payload) {
|
|
|
1473
1484
|
}
|
|
1474
1485
|
|
|
1475
1486
|
var records = data.records || [];
|
|
1487
|
+
var interruptedTotal = 0;
|
|
1488
|
+
for (var ixi = 0; ixi < records.length; ixi++) { if (records[ixi].interrupted) interruptedTotal += 1; }
|
|
1476
1489
|
var dataPath = data.dataPath || "";
|
|
1477
1490
|
var nowPeriod = periodNow(Date.now());
|
|
1478
1491
|
var effectiveAt = data.effectiveAt || 0;
|
|
@@ -1502,6 +1515,16 @@ var api = function (payload) {
|
|
|
1502
1515
|
}, t(sub.z));
|
|
1503
1516
|
})
|
|
1504
1517
|
),
|
|
1518
|
+
el("div", { style: st.diffbox },
|
|
1519
|
+
el("div", { style: st.diffboxTitle }, t("本地统计与官方后台的差异")),
|
|
1520
|
+
el("div", { style: st.diffboxText }, t("本面板统计的是插件在本地捕获的模型调用(按官方价格与峰谷时段计费)。与官方后台(platform.deepseek.com 用量页)相比,金额可能更低,常见原因:")),
|
|
1521
|
+
el("div", { style: st.diffboxText }, t("① 中断/出错/超时的调用:官方仍按实际 token 计费,插件无法获取其用量,按 0 记录(明细中标「中断」);")),
|
|
1522
|
+
el("div", { style: st.diffboxText }, t("② 账号下其他 API Key(如其它应用/脚本)的调用不经过 DeepSeek Harness,官方统计包含它们,本插件不包含;")),
|
|
1523
|
+
el("div", { style: st.diffboxText }, t("③ 如需精确对账,可在官方用量页导出月度账单 CSV 与本插件对比。")),
|
|
1524
|
+
interruptedTotal > 0
|
|
1525
|
+
? el("div", { style: st.diffboxWarn }, t("当前记录中有 ") + fmtInt(interruptedTotal) + t(" 次中断调用(未计费)——对应官方后台已计费的部分。"))
|
|
1526
|
+
: null
|
|
1527
|
+
),
|
|
1505
1528
|
el(BillingHint, null),
|
|
1506
1529
|
el("div", { style: st.note, marginTop: 6 },
|
|
1507
1530
|
t("计价说明:DeepSeek 官方与 SiliconFlow 按人民币价格;DigitalOcean 按美元官方价 × USD/CNY 汇率折算人民币;千问暂不计费;AMD GPU Cloud DeepSeek V4 Flash 免费按 ¥0。")
|
package/lib/index.js
CHANGED
|
@@ -186,6 +186,7 @@ export default {
|
|
|
186
186
|
inputTokens: r.inputTokens, outputTokens: r.outputTokens,
|
|
187
187
|
cacheReadTokens: r.cacheReadTokens, cacheWriteTokens: r.cacheWriteTokens,
|
|
188
188
|
reasoningTokens: r.reasoningTokens, finishReason: r.finishReason,
|
|
189
|
+
interrupted: !!r.interrupted,
|
|
189
190
|
usdCnyRate: r.usdCnyRate || 0, fxDate: r.fxDate || '',
|
|
190
191
|
modelKey: modelKey(r.model),
|
|
191
192
|
baseCost: costFor(r, 'base'), peakValleyCost: costFor(r, 'peakValley'), autoCost: costFor(r, 'auto'),
|
|
@@ -254,7 +255,7 @@ export default {
|
|
|
254
255
|
function buildDays() {
|
|
255
256
|
const map = {}
|
|
256
257
|
for (const r of records) {
|
|
257
|
-
if (!isRealCall(r)) continue;
|
|
258
|
+
if (!isRealCall(r)) continue;
|
|
258
259
|
const key = bjKey(r.time)
|
|
259
260
|
let d = map[key]
|
|
260
261
|
if (!d) {
|
|
@@ -400,6 +401,7 @@ export default {
|
|
|
400
401
|
cacheWriteTokens: toNum(raw.cacheWriteTokens),
|
|
401
402
|
reasoningTokens: toNum(raw.reasoningTokens),
|
|
402
403
|
finishReason: String(raw.finishReason || ''),
|
|
404
|
+
interrupted: !!raw.interrupted,
|
|
403
405
|
usdCnyRate: toNum(raw.usdCnyRate),
|
|
404
406
|
fxDate: String(raw.fxDate || '')
|
|
405
407
|
}
|
|
@@ -559,13 +561,14 @@ export default {
|
|
|
559
561
|
yield chunk
|
|
560
562
|
}
|
|
561
563
|
} finally {
|
|
564
|
+
if (!sessionId) {
|
|
565
|
+
try { const ag = currentAgent(); if (ag && ag.session && ag.session.id) sessionId = String(ag.session.id) } catch (e) {}
|
|
566
|
+
}
|
|
567
|
+
if (provider === 'digital-ocean' || provider === 'digitalocean') {
|
|
568
|
+
try { await refreshFxRate(false) } catch (e) {}
|
|
569
|
+
}
|
|
570
|
+
const isDO = provider === 'digital-ocean' || provider === 'digitalocean'
|
|
562
571
|
if (usage) {
|
|
563
|
-
if (!sessionId) {
|
|
564
|
-
try { const ag = currentAgent(); if (ag && ag.session && ag.session.id) sessionId = String(ag.session.id) } catch (e) {}
|
|
565
|
-
}
|
|
566
|
-
if (provider === 'digital-ocean' || provider === 'digitalocean') {
|
|
567
|
-
try { await refreshFxRate(false) } catch (e) {}
|
|
568
|
-
}
|
|
569
572
|
// 兼容性:DeepSeek 系 provider 的 usage 不单独上报 cacheWriteTokens
|
|
570
573
|
// (缓存写入发生在未命中时,即 cacheWriteTokens == inputTokens)。
|
|
571
574
|
// 当上游未提供该字段时,用未命中 token 数(inputTokens)兜底,避免
|
|
@@ -583,20 +586,42 @@ export default {
|
|
|
583
586
|
cacheWriteTokens: cacheWrite,
|
|
584
587
|
reasoningTokens: usage.reasoningTokens || 0,
|
|
585
588
|
finishReason,
|
|
586
|
-
usdCnyRate:
|
|
587
|
-
fxDate:
|
|
589
|
+
usdCnyRate: isDO ? (FX.rate || 0) : 0,
|
|
590
|
+
fxDate: isDO ? (FX.date || '') : ''
|
|
591
|
+
})
|
|
592
|
+
} else if (isRealCall({ model, provider, time: startedAt })) {
|
|
593
|
+
// 兜底:harness 在流被中断(aborted / error / timeout)时不会产出
|
|
594
|
+
// usage chunk(usage 只在收到 [DONE] 哨兵后才由 adapter yield),
|
|
595
|
+
// 但官方后台仍会按该次请求的实际 token 计费。这里补记一条 0-token
|
|
596
|
+
// 的「中断调用」,使调用次数与官方口径对齐;token 与费用均为 0,
|
|
597
|
+
// 不会虚增消耗。interrupted 标记供客户端 UI 区分展示。
|
|
598
|
+
records.push({
|
|
599
|
+
time: startedAt,
|
|
600
|
+
model,
|
|
601
|
+
provider,
|
|
602
|
+
purpose,
|
|
603
|
+
sessionId,
|
|
604
|
+
inputTokens: 0,
|
|
605
|
+
outputTokens: 0,
|
|
606
|
+
cacheReadTokens: 0,
|
|
607
|
+
cacheWriteTokens: 0,
|
|
608
|
+
reasoningTokens: 0,
|
|
609
|
+
finishReason: finishReason || 'aborted',
|
|
610
|
+
interrupted: true,
|
|
611
|
+
usdCnyRate: 0,
|
|
612
|
+
fxDate: ''
|
|
588
613
|
})
|
|
589
|
-
if (records.length > MAX_RECORDS) records.splice(0, records.length - MAX_RECORDS)
|
|
590
|
-
try {
|
|
591
|
-
const agent = currentAgent()
|
|
592
|
-
const sp = ctx.get('sandboxPolicy')
|
|
593
|
-
if (sp && typeof sp.resolve === 'function' && agent && agent.session) {
|
|
594
|
-
const policy = sp.resolve({ session: agent.session })
|
|
595
|
-
if (policy && policy.workspaceRoot) cachedPolicy = policy
|
|
596
|
-
}
|
|
597
|
-
} catch (e) {}
|
|
598
|
-
ensureSessionRoot().then(persistNow).catch(() => {})
|
|
599
614
|
}
|
|
615
|
+
if (records.length > MAX_RECORDS) records.splice(0, records.length - MAX_RECORDS)
|
|
616
|
+
try {
|
|
617
|
+
const agent = currentAgent()
|
|
618
|
+
const sp = ctx.get('sandboxPolicy')
|
|
619
|
+
if (sp && typeof sp.resolve === 'function' && agent && agent.session) {
|
|
620
|
+
const policy = sp.resolve({ session: agent.session })
|
|
621
|
+
if (policy && policy.workspaceRoot) cachedPolicy = policy
|
|
622
|
+
}
|
|
623
|
+
} catch (e) {}
|
|
624
|
+
ensureSessionRoot().then(persistNow).catch(() => {})
|
|
600
625
|
}
|
|
601
626
|
}
|
|
602
627
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feiyang666/dsh-usage-plugin",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"description": "DeepSeek Harness usage & cost tracker plugin: per-call token/cache-hit stats, peak/off-peak billing, DeepSeek balance query, CSV/JSON/PNG export with custom destination, and persistent local storage. Ships a host half plus a web client half in one npm package; installs into a DSH profile as a dsh.bundle with one command (dsh plugin --profile web add @feiyang666/dsh-usage-plugin).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek",
|
|
@@ -71,8 +71,7 @@
|
|
|
71
71
|
"cordis.patch.yml",
|
|
72
72
|
"README.md",
|
|
73
73
|
"README.zh.md",
|
|
74
|
-
"CHANGELOG.md"
|
|
75
|
-
"RELEASE_NOTES.md"
|
|
74
|
+
"CHANGELOG.md"
|
|
76
75
|
],
|
|
77
76
|
"scripts": {
|
|
78
77
|
"wire": "node scripts/wire.js",
|
package/RELEASE_NOTES.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Release Notes (English)
|
|
2
|
-
|
|
3
|
-
The authoritative **English** release notes for `@feiyang666/dsh-usage-plugin`.
|
|
4
|
-
|
|
5
|
-
Each new version's notes are added at the **top** of this file; the **[Version index](#version-index)** at the **bottom** is the default entry point for jumping to any release.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## v1.14.0 (2026-08-27)
|
|
10
|
-
|
|
11
|
-
This release focuses on **per-message token insights**, cleaner cost breakdowns, **system-level language sync**, and **mobile adaptation**.
|
|
12
|
-
|
|
13
|
-
### Per-message "Turn tokens" popup
|
|
14
|
-
|
|
15
|
-
After a turn finishes, the assistant message's footer action row gains a **"Turn tokens"** button. Clicking it opens a `Token Details` popup with two layers:
|
|
16
|
-
|
|
17
|
-
- **Conversation total** — the whole session's total tokens, total cost, run time and cache-hit rate;
|
|
18
|
-
- **This turn** — this output's tokens, turn tokens, turn cost, turn duration, turn cache-hit rate, a cache-hit bar, and per-model cards (each model's input·miss / cache hit / output (+ reasoning) plus its peak/off-peak cost split).
|
|
19
|
-
|
|
20
|
-
Durations are shown as `Xm Ys`. Every usage record is tagged with the conversation (`sessionId`), so per-turn and per-conversation stats are computed independently.
|
|
21
|
-
|
|
22
|
-
### Internal/tool calls grouped separately
|
|
23
|
-
|
|
24
|
-
Internal/placeholder calls (e.g. `dsh2shell-*` with model `fake`) no longer clutter the model cost tables; they are collected in a collapsible **"Tool calls (internal)"** group below the cost breakdown, so only real model calls count in the cost tables.
|
|
25
|
-
|
|
26
|
-
### Language follows the harness setting
|
|
27
|
-
|
|
28
|
-
The in-panel language toggle is removed; the plugin now follows the harness's own language setting (General Settings → Language) instantly, with no `localStorage` override — this also fixes the "still English after switching back" bug.
|
|
29
|
-
|
|
30
|
-
### Mobile adaptation
|
|
31
|
-
|
|
32
|
-
Tables fit the screen width on ≤900px (no horizontal scrollbar), wide tables collapse the middle columns, and the popup adapts to the viewport.
|
|
33
|
-
|
|
34
|
-
### Also fixed
|
|
35
|
-
|
|
36
|
-
- The popup previously rendered off-screen inside transformed ancestors — now portaled to `document.body`;
|
|
37
|
-
- Per-message windowing now reads the message's real step boundaries, so "this turn" and "conversation total" stats are truly independent;
|
|
38
|
-
- Wide tables no longer wrap numbers into unreadable lines.
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Version index
|
|
43
|
-
|
|
44
|
-
| Version | Date | English notes |
|
|
45
|
-
| --- | --- | --- |
|
|
46
|
-
| v1.14.0 | 2026-08-27 | [What's New in v1.14.0](#v1140-2026-08-27) |
|