dsh-cost-meter 1.9.64 → 1.9.66

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 CHANGED
@@ -1,122 +1,122 @@
1
- <h1 align="center">dsh-cost-meter</h1>
2
-
3
- <p align="center">Cost tracking and subscription quotas for DeepSeek Harness</p>
4
-
5
- <p align="center">
6
- <a href="https://github.com/Han-1413141/dsh-cost-meter/releases/latest"><img src="https://img.shields.io/badge/version-1.9.64-4176E6?style=flat-square" alt="version"></a>
7
- <a href="https://www.npmjs.com/package/dsh-cost-meter"><img src="https://img.shields.io/npm/dm/dsh-cost-meter?label=downloads&style=flat-square&color=4176E6" alt="npm monthly downloads"></a>
8
- <a href="https://github.com/Han-1413141/dsh-cost-meter/stargazers"><img src="https://img.shields.io/github/stars/Han-1413141/dsh-cost-meter?label=stars&style=flat-square&color=D9A400" alt="GitHub stars"></a>
9
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT license"></a>
10
- </p>
11
-
12
- <p align="center"><b>English</b> | <a href="README.zh-CN.md">简体中文</a></p>
13
- <p align="center"><a href="#installation">Install</a> · <a href="#feature-overview">Features</a> · <a href="#screenshots--walkthrough">Screenshots</a> · <a href="#documentation">Docs</a> · <a href="#community">Community</a></p>
14
-
15
- Track costs and tokens by conversation, model and call. View account balances, subscription quotas and budgets together, with separate API charges and Plan equivalents, multi-provider pricing, peak/off-peak alerts, and configurable sidebar and composer displays.
16
-
17
- <p align="center">
18
- <img src="docs/promo.en.png" alt="Whale-themed project illustration" width="1280">
19
- <br><sub>Project illustration</sub>
20
- </p>
21
-
22
- <picture>
23
- <source media="(prefers-color-scheme: dark)" srcset="docs/images/conversation-dark.png">
24
- <img src="docs/images/conversation-light.png" alt="Full conversation view with costs, subscription quotas and account balance" width="1280">
25
- </picture>
26
-
27
- <p align="center"><sub>Full conversation view in light or dark mode to match your theme. Screenshots use example data.</sub></p>
28
-
29
- ## Installation
30
-
31
- Requires **Node.js ≥ 20, DSH 0.2.0 or later**, and pnpm available to DSH. See [host compatibility](docs/host-compatibility.md).
32
-
33
- ```sh
34
- dsh plugin --profile web add dsh-cost-meter
35
- ```
36
-
37
- Restart `dsh web` after installation or updates. **Desktop** uses its bundled CLI and the `desktop` profile; follow the [Desktop guide](docs/install-troubleshooting.md#desktop-安装与更新).
38
-
39
- <details>
40
- <summary>Windows installer / pinned version</summary>
41
-
42
- The PowerShell installer checks pnpm and Git and uses the `web` profile by default:
43
-
44
- ```powershell
45
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.64/install.ps1 | iex
46
- ```
47
-
48
- Install a pinned Git tag:
49
-
50
- ```sh
51
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.64
52
- ```
53
-
54
- See [installation and updates](docs/install.en.md) for uninstalling or installing without Git.
55
-
56
- </details>
57
-
58
- Current release **v1.9.64**: [release notes](docs/update-notes-1.9.64.md#english) · [troubleshooting](docs/install-troubleshooting.md)
59
-
60
- ## Feature overview
61
-
62
- - **Conversation and call costs**: Cost entries in the composer, header and each turn. Inspect rates, tokens, recorded inputs and tool results, including parent/subagent cost attribution.
63
- - **Statistics and exports**: Filter by date, provider and model; inspect trends, rankings, cache hit rates and token heatmaps. Export one or all retained conversations, and view local-model API-equivalent costs separately.
64
- - **Quotas and balances**: Codex / ChatGPT, OpenCode Go, MiniMax, Claude, GLM, Kimi, Qianwen, MiMo, OpenDesign and other plans, plus CLIProxyAPI multi-account quotas and custom HTTP balance sources.
65
- - **Multi-provider pricing**: Automatic model matching, editable rates and multipliers, and peak/off-peak tiers. Sync DeepSeek official prices and the OpenRouter catalog; separate API charges from Plan equivalents.
66
- - **Budgets and pricing alerts**: Daily, monthly, cumulative or custom-date budgets. Peak/off-peak schedules and countdowns, with popup and system notifications before a change.
67
- - **Display and history**: Configure sidebar cards, composer entries, quota strips and turn costs. Chinese/English UI, dark themes and mobile layouts; historical imports, retention and storage controls.
68
-
69
- See [features and screenshots](docs/features.en.md) for entry points and [model and plan support](docs/model-and-plan-adaptation.en.md) for providers and credentials.
70
-
71
- ## Screenshots & walkthrough
72
-
73
- | Cost trends and model ranking | Conversation cost distribution |
74
- |---|---|
75
- | [![Cost trends](docs/images/statistics.png)](docs/images/statistics.png) | [![Conversation treemap](docs/images/treemap.png)](docs/images/treemap.png) |
76
-
77
- | Subscription quotas and balances | Display settings and interactive preview |
78
- |---|---|
79
- | [![Quotas and balances](docs/images/quotas.png)](docs/images/quotas.png) | [![Display settings](docs/images/display.png)](docs/images/display.png) |
80
-
81
- Select an image for full resolution. [More views: call details, prices, history, dark themes and mobile](docs/features.en.md).
82
-
83
- ## Documentation
84
-
85
- | Topic | Guides |
86
- |---|---|
87
- | Setup and use | [Install, update and uninstall](docs/install.en.md) · [Troubleshooting](docs/install-troubleshooting.md) · [Display settings](docs/display-settings.md) |
88
- | Statistics and billing | [Billing rules](docs/billing.en.md) · [Statistics and details](docs/billing-statistics.md#english) · [Models and plans](docs/model-and-plan-adaptation.en.md) · [Peak schedules](docs/provider-peak-schedules.md) |
89
- | Balances and quotas | [Credentials](docs/balance-credentials.md) · [Custom balances](docs/custom-balance-sources.en.md) · [Gateway quotas](docs/cliproxyapi-quota.md) · [Plan estimates](docs/token-plan-stats.md#english) |
90
- | History and storage | [Retention and cleanup](docs/pricing-history-storage.md) · [Repricing](docs/model-history-repricing.md) · [External usage](docs/external-usage.md) · [Ledger recovery](docs/ledger-lock-recovery.md#english) |
91
- | Development | [Architecture and development](docs/architecture.en.md) · [Contributing](CONTRIBUTING.md) · [Host compatibility](docs/host-compatibility.md) |
92
- | Releases | [Update history](docs/UPDATE-HISTORY.md) · [CHANGELOG](CHANGELOG.md) |
93
-
94
- ## Community
95
-
96
- [Open an issue](https://github.com/Han-1413141/dsh-cost-meter/issues) with plugin and host versions, reproduction steps and relevant logs. The WeChat group is available for usage questions and feature discussions.
97
-
98
- <p align="center">
99
- <a href="docs/community-wechat.png"><img src="docs/community-wechat.png" alt="WeChat community QR code" width="280"></a>
100
- </p>
101
-
102
- ## Contributors
103
-
104
- Thanks to everyone who contributes reports, ideas, documentation and code.
105
-
106
- <a href="https://github.com/Han-1413141/dsh-cost-meter/graphs/contributors">
107
- <img src="https://contrib.rocks/image?repo=Han-1413141/dsh-cost-meter" alt="Contributors">
108
- </a>
109
-
110
- ## Star History
111
-
112
- <a href="https://www.star-history.com/?repos=han-1413141%2Fdsh-cost-meter&type=timeline&legend=bottom-right">
113
- <picture>
114
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&theme=dark&legend=bottom-right" />
115
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&legend=bottom-right" />
116
- <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&legend=bottom-right" />
117
- </picture>
118
- </a>
119
-
120
- ## License
121
-
122
- [MIT](LICENSE) © 2026 dsh-cost-meter contributors
1
+ <h1 align="center">dsh-cost-meter</h1>
2
+
3
+ <p align="center">Cost tracking and subscription quotas for DeepSeek Harness</p>
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/Han-1413141/dsh-cost-meter/releases/latest"><img src="https://img.shields.io/badge/version-1.9.66-4176E6?style=flat-square" alt="version"></a>
7
+ <a href="https://www.npmjs.com/package/dsh-cost-meter"><img src="https://img.shields.io/npm/dm/dsh-cost-meter?label=downloads&style=flat-square&color=4176E6" alt="npm monthly downloads"></a>
8
+ <a href="https://github.com/Han-1413141/dsh-cost-meter/stargazers"><img src="https://img.shields.io/github/stars/Han-1413141/dsh-cost-meter?label=stars&style=flat-square&color=D9A400" alt="GitHub stars"></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT license"></a>
10
+ </p>
11
+
12
+ <p align="center"><b>English</b> | <a href="README.zh-CN.md">简体中文</a></p>
13
+ <p align="center"><a href="#installation">Install</a> · <a href="#feature-overview">Features</a> · <a href="#screenshots--walkthrough">Screenshots</a> · <a href="#documentation">Docs</a> · <a href="#community">Community</a></p>
14
+
15
+ Track costs and tokens by conversation, model and call. View account balances, subscription quotas and budgets together, with separate API charges and Plan equivalents, multi-provider pricing, peak/off-peak alerts, and configurable sidebar and composer displays.
16
+
17
+ <p align="center">
18
+ <img src="docs/promo.en.png" alt="Whale-themed project illustration" width="1280">
19
+ <br><sub>Project illustration</sub>
20
+ </p>
21
+
22
+ <picture>
23
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/conversation-dark.png">
24
+ <img src="docs/images/conversation-light.png" alt="Full conversation view with costs, subscription quotas and account balance" width="1280">
25
+ </picture>
26
+
27
+ <p align="center"><sub>Full conversation view in light or dark mode to match your theme. Screenshots use example data.</sub></p>
28
+
29
+ ## Installation
30
+
31
+ Requires **Node.js ≥ 20, DSH 0.2.0 or later**, and pnpm available to DSH. See [host compatibility](docs/host-compatibility.md).
32
+
33
+ ```sh
34
+ dsh plugin --profile web add dsh-cost-meter
35
+ ```
36
+
37
+ Restart `dsh web` after installation or updates. **Desktop** uses its bundled CLI and the `desktop` profile; follow the [Desktop guide](docs/install-troubleshooting.md#desktop-安装与更新).
38
+
39
+ <details>
40
+ <summary>Windows installer / pinned version</summary>
41
+
42
+ The PowerShell installer checks pnpm and Git and uses the `web` profile by default:
43
+
44
+ ```powershell
45
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.66/install.ps1 | iex
46
+ ```
47
+
48
+ Install a pinned Git tag:
49
+
50
+ ```sh
51
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.66
52
+ ```
53
+
54
+ See [installation and updates](docs/install.en.md) for uninstalling or installing without Git.
55
+
56
+ </details>
57
+
58
+ Current release **v1.9.66**: [release notes](docs/update-notes-1.9.66.md#english) · [troubleshooting](docs/install-troubleshooting.md)
59
+
60
+ ## Feature overview
61
+
62
+ - **Conversation and call costs**: Cost entries in the composer, header and each turn. Inspect rates, tokens, recorded inputs and tool results, including parent/subagent cost attribution.
63
+ - **Statistics and exports**: Filter by date, provider and model; inspect trends, rankings, cache hit rates and token heatmaps. Export one or all retained conversations, and view local-model API-equivalent costs separately.
64
+ - **Quotas and balances**: Codex / ChatGPT, OpenCode Go, MiniMax, Claude, GLM, Kimi, Qianwen, MiMo, OpenDesign and other plans, plus CLIProxyAPI multi-account quotas and custom HTTP balance sources.
65
+ - **Multi-provider pricing**: Automatic model matching, editable rates and multipliers, and peak/off-peak tiers. Sync DeepSeek official prices and the OpenRouter catalog; separate API charges from Plan equivalents.
66
+ - **Budgets and pricing alerts**: Daily, monthly, cumulative or custom-date budgets. Peak/off-peak schedules and countdowns, with popup and system notifications before a change.
67
+ - **Display and history**: Configure sidebar cards, composer entries, quota strips and turn costs. Chinese/English UI, dark themes and mobile layouts; historical imports, retention and storage controls.
68
+
69
+ See [features and screenshots](docs/features.en.md) for entry points and [model and plan support](docs/model-and-plan-adaptation.en.md) for providers and credentials.
70
+
71
+ ## Screenshots & walkthrough
72
+
73
+ | Cost trends and model ranking | Conversation cost distribution |
74
+ |---|---|
75
+ | [![Cost trends](docs/images/statistics.png)](docs/images/statistics.png) | [![Conversation treemap](docs/images/treemap.png)](docs/images/treemap.png) |
76
+
77
+ | Subscription quotas and balances | Display settings and interactive preview |
78
+ |---|---|
79
+ | [![Quotas and balances](docs/images/quotas.png)](docs/images/quotas.png) | [![Display settings](docs/images/display.png)](docs/images/display.png) |
80
+
81
+ Select an image for full resolution. [More views: call details, prices, history, dark themes and mobile](docs/features.en.md).
82
+
83
+ ## Documentation
84
+
85
+ | Topic | Guides |
86
+ |---|---|
87
+ | Setup and use | [Install, update and uninstall](docs/install.en.md) · [Troubleshooting](docs/install-troubleshooting.md) · [Display settings](docs/display-settings.md) |
88
+ | Statistics and billing | [Billing rules](docs/billing.en.md) · [Statistics and details](docs/billing-statistics.md#english) · [Models and plans](docs/model-and-plan-adaptation.en.md) · [Peak schedules](docs/provider-peak-schedules.md) |
89
+ | Balances and quotas | [Credentials](docs/balance-credentials.md) · [Custom balances](docs/custom-balance-sources.en.md) · [Gateway quotas](docs/cliproxyapi-quota.md) · [Plan estimates](docs/token-plan-stats.md#english) |
90
+ | History and storage | [Retention and cleanup](docs/pricing-history-storage.md) · [Repricing](docs/model-history-repricing.md) · [External usage](docs/external-usage.md) · [Ledger recovery](docs/ledger-lock-recovery.md#english) |
91
+ | Development | [Architecture and development](docs/architecture.en.md) · [Contributing](CONTRIBUTING.md) · [Host compatibility](docs/host-compatibility.md) |
92
+ | Releases | [Update history](docs/UPDATE-HISTORY.md) · [CHANGELOG](CHANGELOG.md) |
93
+
94
+ ## Community
95
+
96
+ [Open an issue](https://github.com/Han-1413141/dsh-cost-meter/issues) with plugin and host versions, reproduction steps and relevant logs. The WeChat group is available for usage questions and feature discussions.
97
+
98
+ <p align="center">
99
+ <a href="docs/community-wechat.png"><img src="docs/community-wechat.png" alt="WeChat community QR code" width="280"></a>
100
+ </p>
101
+
102
+ ## Contributors
103
+
104
+ Thanks to everyone who contributes reports, ideas, documentation and code.
105
+
106
+ <a href="https://github.com/Han-1413141/dsh-cost-meter/graphs/contributors">
107
+ <img src="https://contrib.rocks/image?repo=Han-1413141/dsh-cost-meter" alt="Contributors">
108
+ </a>
109
+
110
+ ## Star History
111
+
112
+ <a href="https://www.star-history.com/?repos=han-1413141%2Fdsh-cost-meter&type=timeline&legend=bottom-right">
113
+ <picture>
114
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&theme=dark&legend=bottom-right" />
115
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&legend=bottom-right" />
116
+ <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&legend=bottom-right" />
117
+ </picture>
118
+ </a>
119
+
120
+ ## License
121
+
122
+ [MIT](LICENSE) © 2026 dsh-cost-meter contributors
package/README.zh-CN.md CHANGED
@@ -1,122 +1,122 @@
1
- <h1 align="center">dsh-cost-meter</h1>
2
-
3
- <p align="center">DeepSeek Harness 费用统计与订阅额度插件</p>
4
-
5
- <p align="center">
6
- <a href="https://github.com/Han-1413141/dsh-cost-meter/releases/latest"><img src="https://img.shields.io/badge/version-1.9.64-4176E6?style=flat-square" alt="version"></a>
7
- <a href="https://www.npmjs.com/package/dsh-cost-meter"><img src="https://img.shields.io/npm/dm/dsh-cost-meter?label=downloads&style=flat-square&color=4176E6" alt="npm monthly downloads"></a>
8
- <a href="https://github.com/Han-1413141/dsh-cost-meter/stargazers"><img src="https://img.shields.io/github/stars/Han-1413141/dsh-cost-meter?label=stars&style=flat-square&color=D9A400" alt="GitHub stars"></a>
9
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT license"></a>
10
- </p>
11
-
12
- <p align="center"><a href="README.md">English</a> | <b>简体中文</b></p>
13
- <p align="center"><a href="#安装">安装</a> · <a href="#功能总览">功能</a> · <a href="#图文演示">界面</a> · <a href="#文档">文档</a> · <a href="#交流与反馈">交流</a></p>
14
-
15
- 按会话、模型和调用查看费用与 Token 用量,集中显示账户余额、套餐额度和预算。支持 API 费用与 Plan 等值费用分开统计、多厂商定价、峰谷提醒,以及侧栏和输入区的独立显示设置。
16
-
17
- <p align="center">
18
- <img src="docs/promo.png" alt="鲸鱼主题项目宣传图" width="1280">
19
- <br><sub>项目宣传图</sub>
20
- </p>
21
-
22
- <picture>
23
- <source media="(prefers-color-scheme: dark)" srcset="docs/images/conversation-dark.png">
24
- <img src="docs/images/conversation-light.png" alt="完整会话界面,包含会话费用、套餐额度与账户余额" width="1280">
25
- </picture>
26
-
27
- <p align="center"><sub>完整会话界面,随主题切换浅色与深色。截图使用示例数据。</sub></p>
28
-
29
- ## 安装
30
-
31
- 需要 **Node.js ≥ 20、DSH 0.2.0 或更新版本**,以及 DSH 可用的 pnpm。[宿主兼容记录](docs/host-compatibility.md)
32
-
33
- ```sh
34
- dsh plugin --profile web add dsh-cost-meter
35
- ```
36
-
37
- 安装或更新后重启 `dsh web`。**Desktop** 使用应用自带 CLI 和 `desktop` Profile,见 [Desktop 安装与更新](docs/install-troubleshooting.md#desktop-安装与更新)。
38
-
39
- <details>
40
- <summary>Windows 一键安装 / 固定版本安装</summary>
41
-
42
- PowerShell 脚本自动检查 pnpm 和 Git,默认安装到 `web` Profile:
43
-
44
- ```powershell
45
- irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.64/install.ps1 | iex
46
- ```
47
-
48
- 固定 Git tag 安装:
49
-
50
- ```sh
51
- dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.64
52
- ```
53
-
54
- 更新、卸载及无 Git 的安装方法见[安装说明](docs/install.md)。
55
-
56
- </details>
57
-
58
- 当前版本 **v1.9.64**:[更新说明](docs/update-notes-1.9.64.md#中文) · [安装排障](docs/install-troubleshooting.md)
59
-
60
- ## 功能总览
61
-
62
- - **费用明细**:输入区、标题栏和每轮回复显示费用;展开查看单价、Token、输入内容及工具结果。支持父子代理费用归属。
63
- - **费用统计**:按日期、渠道和模型筛选,查看趋势、模型排行、缓存命中率与 Token 热图;导出单个或全部会话记录;单独查看本地模型的 API 等值费用。
64
- - **套餐额度**:支持 Codex / ChatGPT、OpenCode Go、MiniMax、Claude、GLM、Kimi、千问、MiMo、OpenDesign 等;提供 CLIProxyAPI 多账号额度及自定义 HTTP 余额查询。
65
- - **模型定价**:自动匹配模型价格,编辑单价、倍率及峰谷档位;同步 DeepSeek 官方价格和 OpenRouter 目录。API 与 Plan 分开统计。
66
- - **预算提醒**:按日、月、累计或自定义日期设预算;显示峰谷时段和倒计时,支持切换前弹窗与系统通知。
67
- - **显示与历史**:自定义侧栏、输入区、额度横条和每轮费用;支持中英双语、深色主题和手机端。可导入历史、设置保留范围及管理存储。
68
-
69
- 功能入口和配置见[功能与截图](docs/features.md);厂商、模型及凭据要求见[适配说明](docs/model-and-plan-adaptation.md)。
70
-
71
- ## 图文演示
72
-
73
- | 费用趋势与模型排行 | 单个会话费用分布 |
74
- |---|---|
75
- | [![费用趋势与模型排行](docs/images/statistics.png)](docs/images/statistics.png) | [![会话费用矩形图](docs/images/treemap.png)](docs/images/treemap.png) |
76
-
77
- | 套餐额度与余额 | 显示设置与交互预览 |
78
- |---|---|
79
- | [![套餐额度与余额](docs/images/quotas.png)](docs/images/quotas.png) | [![显示设置与交互预览](docs/images/display.png)](docs/images/display.png) |
80
-
81
- 点击图片查看大图。[更多界面:调用详情、价格、历史、深色与手机端](docs/features.md)
82
-
83
- ## 文档
84
-
85
- | 主题 | 文档 |
86
- |---|---|
87
- | 安装与使用 | [安装、更新、卸载](docs/install.md) · [安装排障](docs/install-troubleshooting.md) · [显示设置](docs/display-settings.md) |
88
- | 统计与计费 | [计费规则](docs/billing.md) · [统计与明细](docs/billing-statistics.md#简体中文) · [模型定价与适配](docs/model-and-plan-adaptation.md) · [峰谷时段](docs/provider-peak-schedules.md) |
89
- | 余额与套餐 | [凭据来源](docs/balance-credentials.md) · [自定义余额](docs/custom-balance-sources.md) · [网关额度](docs/cliproxyapi-quota.md) · [套餐用量估算](docs/token-plan-stats.md) |
90
- | 历史与存储 | [保留与清理](docs/pricing-history-storage.md) · [历史重定价](docs/model-history-repricing.md) · [外部用量](docs/external-usage.md) · [账本恢复](docs/ledger-lock-recovery.md#简体中文) |
91
- | 开发与贡献 | [架构与开发](docs/architecture.md) · [贡献指南](CONTRIBUTING.md) · [宿主兼容](docs/host-compatibility.md) |
92
- | 版本记录 | [更新历史](docs/UPDATE-HISTORY.md) · [CHANGELOG](CHANGELOG.md) |
93
-
94
- ## 交流与反馈
95
-
96
- [提交 issue](https://github.com/Han-1413141/dsh-cost-meter/issues) 时请附插件版本、宿主版本、复现步骤和相关日志。使用交流与功能讨论可加入微信群。
97
-
98
- <p align="center">
99
- <a href="docs/community-wechat.png"><img src="docs/community-wechat.png" alt="微信交流群二维码" width="280"></a>
100
- </p>
101
-
102
- ## 贡献者
103
-
104
- 感谢社区的问题报告、功能建议、文档和代码贡献。
105
-
106
- <a href="https://github.com/Han-1413141/dsh-cost-meter/graphs/contributors">
107
- <img src="https://contrib.rocks/image?repo=Han-1413141/dsh-cost-meter" alt="Contributors">
108
- </a>
109
-
110
- ## Star 增长记录
111
-
112
- <a href="https://www.star-history.com/?repos=han-1413141%2Fdsh-cost-meter&type=timeline&legend=bottom-right">
113
- <picture>
114
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&theme=dark&legend=bottom-right" />
115
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&legend=bottom-right" />
116
- <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&legend=bottom-right" />
117
- </picture>
118
- </a>
119
-
120
- ## License
121
-
122
- [MIT](LICENSE) © 2026 dsh-cost-meter contributors
1
+ <h1 align="center">dsh-cost-meter</h1>
2
+
3
+ <p align="center">DeepSeek Harness 费用统计与订阅额度插件</p>
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/Han-1413141/dsh-cost-meter/releases/latest"><img src="https://img.shields.io/badge/version-1.9.66-4176E6?style=flat-square" alt="version"></a>
7
+ <a href="https://www.npmjs.com/package/dsh-cost-meter"><img src="https://img.shields.io/npm/dm/dsh-cost-meter?label=downloads&style=flat-square&color=4176E6" alt="npm monthly downloads"></a>
8
+ <a href="https://github.com/Han-1413141/dsh-cost-meter/stargazers"><img src="https://img.shields.io/github/stars/Han-1413141/dsh-cost-meter?label=stars&style=flat-square&color=D9A400" alt="GitHub stars"></a>
9
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT license"></a>
10
+ </p>
11
+
12
+ <p align="center"><a href="README.md">English</a> | <b>简体中文</b></p>
13
+ <p align="center"><a href="#安装">安装</a> · <a href="#功能总览">功能</a> · <a href="#图文演示">界面</a> · <a href="#文档">文档</a> · <a href="#交流与反馈">交流</a></p>
14
+
15
+ 按会话、模型和调用查看费用与 Token 用量,集中显示账户余额、套餐额度和预算。支持 API 费用与 Plan 等值费用分开统计、多厂商定价、峰谷提醒,以及侧栏和输入区的独立显示设置。
16
+
17
+ <p align="center">
18
+ <img src="docs/promo.png" alt="鲸鱼主题项目宣传图" width="1280">
19
+ <br><sub>项目宣传图</sub>
20
+ </p>
21
+
22
+ <picture>
23
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/conversation-dark.png">
24
+ <img src="docs/images/conversation-light.png" alt="完整会话界面,包含会话费用、套餐额度与账户余额" width="1280">
25
+ </picture>
26
+
27
+ <p align="center"><sub>完整会话界面,随主题切换浅色与深色。截图使用示例数据。</sub></p>
28
+
29
+ ## 安装
30
+
31
+ 需要 **Node.js ≥ 20、DSH 0.2.0 或更新版本**,以及 DSH 可用的 pnpm。[宿主兼容记录](docs/host-compatibility.md)
32
+
33
+ ```sh
34
+ dsh plugin --profile web add dsh-cost-meter
35
+ ```
36
+
37
+ 安装或更新后重启 `dsh web`。**Desktop** 使用应用自带 CLI 和 `desktop` Profile,见 [Desktop 安装与更新](docs/install-troubleshooting.md#desktop-安装与更新)。
38
+
39
+ <details>
40
+ <summary>Windows 一键安装 / 固定版本安装</summary>
41
+
42
+ PowerShell 脚本自动检查 pnpm 和 Git,默认安装到 `web` Profile:
43
+
44
+ ```powershell
45
+ irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.9.66/install.ps1 | iex
46
+ ```
47
+
48
+ 固定 Git tag 安装:
49
+
50
+ ```sh
51
+ dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.9.66
52
+ ```
53
+
54
+ 更新、卸载及无 Git 的安装方法见[安装说明](docs/install.md)。
55
+
56
+ </details>
57
+
58
+ 当前版本 **v1.9.66**:[更新说明](docs/update-notes-1.9.66.md#中文) · [安装排障](docs/install-troubleshooting.md)
59
+
60
+ ## 功能总览
61
+
62
+ - **费用明细**:输入区、标题栏和每轮回复显示费用;展开查看单价、Token、输入内容及工具结果。支持父子代理费用归属。
63
+ - **费用统计**:按日期、渠道和模型筛选,查看趋势、模型排行、缓存命中率与 Token 热图;导出单个或全部会话记录;单独查看本地模型的 API 等值费用。
64
+ - **套餐额度**:支持 Codex / ChatGPT、OpenCode Go、MiniMax、Claude、GLM、Kimi、千问、MiMo、OpenDesign 等;提供 CLIProxyAPI 多账号额度及自定义 HTTP 余额查询。
65
+ - **模型定价**:自动匹配模型价格,编辑单价、倍率及峰谷档位;同步 DeepSeek 官方价格和 OpenRouter 目录。API 与 Plan 分开统计。
66
+ - **预算提醒**:按日、月、累计或自定义日期设预算;显示峰谷时段和倒计时,支持切换前弹窗与系统通知。
67
+ - **显示与历史**:自定义侧栏、输入区、额度横条和每轮费用;支持中英双语、深色主题和手机端。可导入历史、设置保留范围及管理存储。
68
+
69
+ 功能入口和配置见[功能与截图](docs/features.md);厂商、模型及凭据要求见[适配说明](docs/model-and-plan-adaptation.md)。
70
+
71
+ ## 图文演示
72
+
73
+ | 费用趋势与模型排行 | 单个会话费用分布 |
74
+ |---|---|
75
+ | [![费用趋势与模型排行](docs/images/statistics.png)](docs/images/statistics.png) | [![会话费用矩形图](docs/images/treemap.png)](docs/images/treemap.png) |
76
+
77
+ | 套餐额度与余额 | 显示设置与交互预览 |
78
+ |---|---|
79
+ | [![套餐额度与余额](docs/images/quotas.png)](docs/images/quotas.png) | [![显示设置与交互预览](docs/images/display.png)](docs/images/display.png) |
80
+
81
+ 点击图片查看大图。[更多界面:调用详情、价格、历史、深色与手机端](docs/features.md)
82
+
83
+ ## 文档
84
+
85
+ | 主题 | 文档 |
86
+ |---|---|
87
+ | 安装与使用 | [安装、更新、卸载](docs/install.md) · [安装排障](docs/install-troubleshooting.md) · [显示设置](docs/display-settings.md) |
88
+ | 统计与计费 | [计费规则](docs/billing.md) · [统计与明细](docs/billing-statistics.md#简体中文) · [模型定价与适配](docs/model-and-plan-adaptation.md) · [峰谷时段](docs/provider-peak-schedules.md) |
89
+ | 余额与套餐 | [凭据来源](docs/balance-credentials.md) · [自定义余额](docs/custom-balance-sources.md) · [网关额度](docs/cliproxyapi-quota.md) · [套餐用量估算](docs/token-plan-stats.md) |
90
+ | 历史与存储 | [保留与清理](docs/pricing-history-storage.md) · [历史重定价](docs/model-history-repricing.md) · [外部用量](docs/external-usage.md) · [账本恢复](docs/ledger-lock-recovery.md#简体中文) |
91
+ | 开发与贡献 | [架构与开发](docs/architecture.md) · [贡献指南](CONTRIBUTING.md) · [宿主兼容](docs/host-compatibility.md) |
92
+ | 版本记录 | [更新历史](docs/UPDATE-HISTORY.md) · [CHANGELOG](CHANGELOG.md) |
93
+
94
+ ## 交流与反馈
95
+
96
+ [提交 issue](https://github.com/Han-1413141/dsh-cost-meter/issues) 时请附插件版本、宿主版本、复现步骤和相关日志。使用交流与功能讨论可加入微信群。
97
+
98
+ <p align="center">
99
+ <a href="docs/community-wechat.png"><img src="docs/community-wechat.png" alt="微信交流群二维码" width="280"></a>
100
+ </p>
101
+
102
+ ## 贡献者
103
+
104
+ 感谢社区的问题报告、功能建议、文档和代码贡献。
105
+
106
+ <a href="https://github.com/Han-1413141/dsh-cost-meter/graphs/contributors">
107
+ <img src="https://contrib.rocks/image?repo=Han-1413141/dsh-cost-meter" alt="Contributors">
108
+ </a>
109
+
110
+ ## Star 增长记录
111
+
112
+ <a href="https://www.star-history.com/?repos=han-1413141%2Fdsh-cost-meter&type=timeline&legend=bottom-right">
113
+ <picture>
114
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&theme=dark&legend=bottom-right" />
115
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&legend=bottom-right" />
116
+ <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=han-1413141/dsh-cost-meter&type=timeline&legend=bottom-right" />
117
+ </picture>
118
+ </a>
119
+
120
+ ## License
121
+
122
+ [MIT](LICENSE) © 2026 dsh-cost-meter contributors
@@ -0,0 +1,56 @@
1
+ # 官方余额的凭据来源
2
+
3
+ DSH 的账号登录模式使用推理令牌,它与开放平台 API Key 是不同凭据:把推理令牌当作 `Authorization: Bearer` 发给 `/user/balance` 会返回 401。旧版插件只读取模型设置指定的凭据名,在该名称被宿主进程环境覆盖时无法选用凭据库里的开放平台 Key([#201](https://github.com/Han-1413141/dsh-cost-meter/issues/201))。
4
+
5
+ ## 已登录的官方账号(DSH 桌面版)
6
+
7
+ 登录官方账号后,无需另行保存 API Key。未选择其他余额账号、未配置余额专用 Key 或模型 Key 时,插件通过宿主 `deepseekAccount` 服务读取与「设置 → 账号」同源的钱包,包含充值钱包与赠送钱包,再沿用插件自身的多币种挑选规则。凭据由宿主账号服务持有并负责鉴权,插件不接触 token,也不直接请求 `platform.deepseek.com`。账号服务缺席或明确退出时,该来源不可用;已登录账号的查询失败会显示错误。
8
+
9
+ 模型 Key 与登录账号可以属于不同账户。未选择其他余额账号、也未配置专用 Key 时,模型 Key 优先于登录账号钱包。
10
+
11
+ ## 余额专用 API Key
12
+
13
+ 从 1.7.46 起,也可以在「设置 → 费用 → 官方账户余额」的「余额专用 API Key」中填写开放平台 Key,点击「保存」,再点击「刷新余额」。密钥通过现有凭据接口写入 DSH 凭据库中的 `DEEPSEEK_BALANCE_API_KEY`,不写入插件配置、账本或安装目录,不回传到浏览器。输入框保存后清空,只显示是否配置及来源。也可以在启动 DSH 的环境中设置同名变量;该变量遵循宿主的只读环境优先规则。
14
+
15
+ Desktop 使用相同的费用设置页与宿主凭据接口。更新时使用 Desktop 自带 CLI 的 `--profile desktop`,然后完全退出并重新打开 Desktop;[桌面端安装步骤](install-troubleshooting.md#desktop-安装与更新)包含命令来源与重装禁用状态的处理。
16
+
17
+ ## 查询规则
18
+
19
+ 1. 手动选择了其他余额账号时,只使用所选账号的 Key 请求 `https://api.deepseek.com/user/balance`。Key 缺失或查询失败时直接显示错误。
20
+ 2. 使用默认余额账号且配置了专用 Key 时,只使用该 Key 请求官方余额,与模型的 `baseURL`、`apiKeyEnv` 及账号登录状态无关。
21
+ 3. 未配置专用 Key,但配置了模型 API Key 时,用模型 Key 查询余额。支持 DeepSeek 官方 HTTPS 根地址、版本路径以及 `/anthropic`、`/anthropic/v1`;实际余额请求始终发往 `/user/balance`。中转或代理地址不受支持,不发送请求,也不改查登录账号的钱包。
22
+ 4. 没有模型 API Key 时,经宿主账号服务读取账号钱包,即使模型设置暂时不可读。手动刷新会重新读取失败的模型设置。账号服务缺席或明确退出时,该来源不可用;已登录但查询失败时显示账号侧错误,自动查询按刷新间隔重试。
23
+ 5. 专用 Key 返回 401 时显示认证失败及配置方法,不改用其他账户重试。自动查询遵守刷新间隔,手动刷新可立即重试。
24
+ 6. 保存或清除专用 Key 会作废旧余额、取消在途请求并重新建立对账基准;不修改模型凭据。清除后按上面的顺序重新选择来源。
25
+
26
+ 当前余额凭据更换、清除,以及所用模型路由的 `apiKeyEnv` 或 `baseURL` 变化,会作废余额缓存、在途响应与对账基准。无关模型配置不影响手动选择的余额账号或专用 Key。账号退出、凭据失效及账号服务替换同样会清除旧状态。插件只读取宿主公开的配置描述与生命周期事件;重新挂载时,为所有余额来源重新建立对账基准。
27
+
28
+ ## 已保存的 Key 返回 401
29
+
30
+ “已配置,来源为 file”表示 DSH 凭据库里有这个值,不表示开放平台仍接受它。HTTP 401 表示当前请求的凭据未通过官方认证;仅凭状态码无法区分 Key 被撤销、保存内容不完整或凭据类型不对。重新保存相同内容不会改变服务端认证结果,最小化窗口也不会使无效 Key 恢复。
31
+
32
+ 请在 DeepSeek 开放平台确认 Key 状态。旧 Key 已丢失、无法核对时,创建新 Key,保存到“余额专用 API Key”,然后点击“刷新余额”。输入框保存后清空是隐藏密钥的正常行为,不是凭据丢失。不要在 issue 中上传 Key、凭据文件或请求头。
33
+
34
+ [#502](https://github.com/Han-1413141/dsh-cost-meter/issues/502#issuecomment-6877106296) 的报告者 @7WhiteChocolate 确认换用新建 Key 后恢复。旧 Key 未保留,具体失效原因没有得到验证;本次没有把该问题归因于窗口恢复或插件更新,也没有改变余额来源顺序。
35
+
36
+ ## 验证
37
+
38
+ 验证使用合成凭据和 HTTP 响应,覆盖真实 DSH 凭据 provider 的「进程环境优先于凭据文件」行为、保存/清除、缓存取消、迟到响应、对账基准以及 Host/Client codec。专项回归还覆盖账号与模型 Key 的来源优先级、旧版设置接口与新版配置描述、模型路由切换、官方 Messages 地址、账号异常脱敏、刷新节流、对账基准持久化及客户端错误渲染。
39
+
40
+ ## English
41
+
42
+ DSH account login uses an inference token, which is not an Open Platform API key: sending it as `Authorization: Bearer` to `/user/balance` returns 401. Older plugin versions read only the credential name named by the model settings, so a host-provided environment variable of that name could shadow a stored Open Platform key ([#201](https://github.com/Han-1413141/dsh-cost-meter/issues/201)).
43
+
44
+ **Signed-in official account (DSH Desktop).** No additional API key is needed. When no other balance account is selected and no dedicated or model Key is configured, the plugin reads the same wallet as **Settings → Account** (topped-up plus bonus) through the host `deepseekAccount` service, then applies its multi-currency selection. The host account service holds and uses the credential; the plugin never sees the token and never requests `platform.deepseek.com` directly. A missing account service or an explicit sign-out makes this source unavailable; a failed query for a signed-in account produces an error.
45
+
46
+ The model Key and the signed-in account can belong to different accounts. When no other balance account is selected and no dedicated key is configured, a model key takes priority over the signed-in account’s wallet.
47
+
48
+ Alternatively, since 1.7.46, enter an Open Platform key in **Settings → Cost → Account balance → Balance API key**, save it, then refresh the balance. DSH stores it as `DEEPSEEK_BALANCE_API_KEY`; the plugin never stores it in its config or ledger, or returns it to the browser. The same environment variable is supported under the host's normal credential priority rules.
49
+
50
+ Query priority is **manually selected balance account → dedicated Key → model Key → signed-in account**. A manually selected account or dedicated Key uses the fixed official HTTPS balance endpoint. A missing or invalid selected Key produces an error. Model settings support the official root, version paths, `/anthropic`, and `/anthropic/v1`. Balance requests use `https://api.deepseek.com/user/balance`. A relay or proxy `baseURL` produces an unsupported-endpoint error without sending the Key or querying the signed-in wallet. Account-query failures remain visible, and automatic retries follow the refresh interval. Saving or clearing the dedicated Key leaves model credentials intact. Account-login inference tokens cannot query the Open Platform balance endpoint directly.
51
+
52
+ Changes to the active balance credential or its model route (`apiKeyEnv` or `baseURL`) invalidate cached and in-flight balances and clear reconciliation baselines. Unrelated model changes leave manually selected accounts and dedicated Keys unchanged. Account sign-out, expiry, and account-service replacement also clear old state. The plugin reads public configuration descriptions and lifecycle events. Every balance source establishes a new reconciliation baseline when the plugin mounts again.
53
+
54
+ When no model API key is resolved, an unavailable model settings service does not block the signed-in account wallet. Manual refresh retries an unavailable route; a resolved model Key still requires a verified official endpoint.
55
+
56
+ **A stored key returns HTTP 401.** “Configured, source: file” only confirms that DSH has a stored value. HTTP 401 means that the official API rejected the credential; the status alone cannot distinguish a revoked key, an incomplete value or the wrong credential type. Check the key in the DeepSeek Open Platform. If the old value is unavailable, create a new key, save it as the dedicated balance key and refresh. Clearing the input after saving hides the secret; it does not delete the stored credential. Never post keys, credential files or request headers in an issue. In [#502](https://github.com/Han-1413141/dsh-cost-meter/issues/502#issuecomment-6877106296), @7WhiteChocolate confirmed that a new key restored the balance. The reason the old key stopped working was not established.