@nomxy/dsh-balance 0.1.0 → 0.1.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/README.md +65 -4
- package/docs/chip.png +0 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@ DeepSeek Harness 侧边栏余额胶囊:把 **DeepSeek 官方账户余额** 和
|
|
|
4
4
|
|
|
5
5
|
`¥56.10 · 谷 1d9h`
|
|
6
6
|
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
<sub>图中为按 `lib/client.js` 的样式渲染的外观预览(同一份 CSS,脱离 DSH 页面单独成像);实际位置在侧栏名字按钮右侧、连接指示灯左侧。</sub>
|
|
10
|
+
|
|
7
11
|
- **余额**:来自 DeepSeek 官方 `GET /user/balance`,用 DSH 凭证服务里的 `DEEPSEEK_API_KEY`(不出本机)。
|
|
8
12
|
- **峰谷**:官方高峰/空闲时段实时判断,橙色「峰」/ 绿色「谷」,后面跟距下次切换的倒计时(`2d15h` / `5h47m` / `23m`),每 15 秒刷新。
|
|
9
13
|
- **当前档位单价**:鼠标悬停显示输入 / 输入缓存 / 输出单价(元 / 百万 tokens),以及余额是否可用。
|
|
@@ -12,11 +16,52 @@ DeepSeek Harness 侧边栏余额胶囊:把 **DeepSeek 官方账户余额** 和
|
|
|
12
16
|
|
|
13
17
|
## 安装
|
|
14
18
|
|
|
19
|
+
从 npm 装(当前版本 `0.1.1`):
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
dsh plugin --profile <你的 profile> add @nomxy/dsh-balance@0.1.1
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
装完刷新页面或重启 DSH 即生效。要求 DSH `>= 0.2.1`(需要 `dsh.client` + `dsh.bundle` 清单)。
|
|
26
|
+
|
|
27
|
+
常用配套命令:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
# 看装了哪些版本
|
|
31
|
+
dsh plugin --profile <profile> list
|
|
32
|
+
|
|
33
|
+
# 升级到最新
|
|
34
|
+
dsh plugin --profile <profile> update @nomxy/dsh-balance
|
|
35
|
+
|
|
36
|
+
# 卸载
|
|
37
|
+
dsh plugin --profile <profile> remove @nomxy/dsh-balance
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
装完可以做一次自检(把端口换成你当前 GUI 的端口,可在 DSH 窗口标题或 `dsh web` 输出里看到):
|
|
41
|
+
|
|
15
42
|
```sh
|
|
16
|
-
|
|
43
|
+
curl -s http://127.0.0.1:<port>/api/dsh-balance
|
|
44
|
+
# {"ok":true,"balance":{"isAvailable":true,"total":53.08,"currency":"CNY"},
|
|
45
|
+
# "peak":false,"next":{"peak":true,"at":...,"ms":...},
|
|
46
|
+
# "tier":{"input":1,"cacheRead":0.02,"cacheWrite":0,"output":4,"model":"deepseek-flash","known":true}}
|
|
17
47
|
```
|
|
18
48
|
|
|
19
|
-
|
|
49
|
+
侧栏出现 `¥53.08 · 谷 19h` 这样的胶囊即为成功。
|
|
50
|
+
|
|
51
|
+
## 峰谷说明
|
|
52
|
+
|
|
53
|
+
胶囊里的「峰 / 谷」用的是 DeepSeek 官方峰谷计费口径,逐条如下(实现见 `lib/pricing.js`):
|
|
54
|
+
|
|
55
|
+
| 项目 | 规则 |
|
|
56
|
+
|---|---|
|
|
57
|
+
| 高峰时段 | 北京时间 **09:00–12:00**、**14:00–18:00**(半开区间,12:00 整属于空闲) |
|
|
58
|
+
| 适用日 | **周一至周五**;周末全天按空闲计价(调休上班的周末也算空闲) |
|
|
59
|
+
| 法定节假日 | 全天按空闲计价(`HOLIDAY_RANGES` 内置 2026 年及以前的中国法定节假日表) |
|
|
60
|
+
| 时区 | 判定固定按北京时间(UTC+8,无夏令时),与部署机器时区无关 |
|
|
61
|
+
| 倒计时 | 距**下一次峰谷切换**的时长:午休结束 `12:00→14:00` 显示 `2h`;周五 18:00 之后显示到下周一 09:00(如 `2d15h`) |
|
|
62
|
+
| 价格 | 悬停提示的单价按当前所处的峰谷档取(元 / 百万 tokens),缓存写官方暂不计费(0) |
|
|
63
|
+
|
|
64
|
+
两种颜色:**峰**=`#d97706`(橙)、**谷**=`#15803d`(绿);模型不在内置价格表里(例如第三方网关上的同名模型)时,胶囊只显示余额,不显示峰谷。
|
|
20
65
|
|
|
21
66
|
## 配置
|
|
22
67
|
|
|
@@ -34,7 +79,7 @@ dsh plugin --profile <你的 profile> add @nomxy/dsh-balance
|
|
|
34
79
|
## 已知限制
|
|
35
80
|
|
|
36
81
|
- 只支持 DeepSeek 官方平台余额;第三方路由上的同名模型不适用官方峰谷定价,此时只显示余额。
|
|
37
|
-
- 峰谷与节假日规则是内置表(`lib/pricing.js
|
|
82
|
+
- 峰谷与节假日规则是内置表(`lib/pricing.js`),官方调整规则或发布次年放假日历时需要更新版本。
|
|
38
83
|
- 胶囊是通过 DOM 挂载进侧栏名字行的(DSH 没有「名字后面」这个槽位),因此侧栏结构大改时需要跟着调整选择器 `div[class*="triggerRow"]`。
|
|
39
84
|
|
|
40
85
|
## 来源与致谢
|
|
@@ -43,6 +88,8 @@ dsh plugin --profile <你的 profile> add @nomxy/dsh-balance
|
|
|
43
88
|
[@dougen/dsh-deepseek-usage](https://github.com/dougen/dsh-deepseek-usage)(MIT),仅把插件 id 与路由改名,并去掉了对 `@deepseek-ai/dsh-credentials` 的运行时依赖(`credentialRef` 是编译期 brand,运行时为恒等函数)。
|
|
44
89
|
客户端半(`lib/client.js`)为本项目重写:不注册槽位,直接挂载紧凑胶囊。
|
|
45
90
|
|
|
91
|
+
本项目的代码、发布到 npm、以及向 [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin) 提交的收录条目,均由作者本机运行的 **DSH(DeepSeek Harness)** 代理端到端完成,作者负责需求与授权。
|
|
92
|
+
|
|
46
93
|
## License
|
|
47
94
|
|
|
48
95
|
MIT,见 [LICENSE](./LICENSE)(包含上游 MIT 声明)。
|
|
@@ -51,4 +98,18 @@ MIT,见 [LICENSE](./LICENSE)(包含上游 MIT 声明)。
|
|
|
51
98
|
|
|
52
99
|
## English
|
|
53
100
|
|
|
54
|
-
A 20px balance chip for the DeepSeek Harness sidebar footer, sitting right of the name row: official DeepSeek balance plus the current peak/off-peak window with a countdown to the next switch, hover for the active model's unit prices, click to refresh. No telemetry; the host half only serves two loopback-only routes.
|
|
101
|
+
A 20px balance chip for the DeepSeek Harness sidebar footer, sitting right of the name row: official DeepSeek balance plus the current peak/off-peak window with a countdown to the next switch, hover for the active model's unit prices, click to refresh. No telemetry; the host half only serves two loopback-only routes.
|
|
102
|
+
|
|
103
|
+

|
|
104
|
+
|
|
105
|
+
**Peak/off-peak (official DeepSeek billing rules):** peak = Beijing time 09:00–12:00 and 14:00–18:00 on weekdays only; everything else — weekends (even make-up workdays), Chinese public holidays, and the 12:00–14:00 lunch gap — is off-peak/idle. The countdown shows the time until the next switch (e.g. `2d15h` from Friday 18:00 to Monday 09:00).
|
|
106
|
+
|
|
107
|
+
**Install:**
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
dsh plugin --profile <your-profile> add @nomxy/dsh-balance@0.1.1
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Requires DSH `>= 0.2.1` (`dsh.client` + `dsh.bundle` present). Verify with `curl -s http://127.0.0.1:<port>/api/dsh-balance`.
|
|
114
|
+
|
|
115
|
+
Host half derived from `@dougen/dsh-deepseek-usage` (MIT). Code, the npm publish, and the awesome-dsh-plugin listing were all prepared end-to-end by **DSH (DeepSeek Harness)**, the agent running on the author's own machine.
|
package/docs/chip.png
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomxy/dsh-balance",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Compact DeepSeek balance + peak/off-peak chip in the sidebar name row. · 侧边栏名字旁的 DeepSeek 余额与峰谷小胶囊。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"lib",
|
|
16
|
+
"docs",
|
|
16
17
|
"cordis.patch.yml",
|
|
17
18
|
"README.md",
|
|
18
19
|
"LICENSE",
|