@rayadesu/dsh-billing 0.2.4 → 0.3.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/AGENTS.md +1 -1
- package/README.i18n.yaml +2 -2
- package/README.md +11 -4
- package/README.zh.md +12 -5
- package/package.json +18 -13
- package/preview-overview.png +0 -0
- package/preview-turn-cost.png +0 -0
package/AGENTS.md
CHANGED
|
@@ -47,7 +47,7 @@ cordis.patch.yml DSH profile bundle 补丁层:挂载 llm-billing + ui-
|
|
|
47
47
|
- **密钥不进仓库**:`DEEPSEEK_API_KEY` 等一律由用户环境或凭据 seam 提供,仓库不含真实值。
|
|
48
48
|
- **README 双语**:每个 README 遵循 DSH 结构 `README.md`(EN) + `README.zh.md`(ZH) +
|
|
49
49
|
`README.i18n.yaml`(记录两文件 git blob hash,改动后需更新)。
|
|
50
|
-
- **版本对齐**:根 bundle 与两个包统一版本号(当前 0.
|
|
50
|
+
- **版本对齐**:根 bundle 与两个包统一版本号(当前 0.3.0),`pnpm-lock.yaml` 随依赖变更更新。
|
|
51
51
|
- **文本规范**:LF 换行、文件末尾一个换行(`.editorconfig`/`.gitattributes` 已声明)。
|
|
52
52
|
|
|
53
53
|
## 常用命令
|
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# last confirmed-consistent state. Both languages carry equal authority; after
|
|
3
3
|
# editing either side, bring the other along and re-record both hashes with:
|
|
4
4
|
# git hash-object README.md README.zh.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 043453b28aa797ae654f2fa8653a547c1a9dd13b
|
|
6
|
+
README.zh.md: bd3f35d13149144e519b31a01960066df9c53423
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin tha
|
|
|
10
10
|
|
|
11
11
|
- **Session-header badge** — two lines: remaining balance (`剩余额度:¥X`) and this conversation's billed spend (`本轮对话花费:¥X`).
|
|
12
12
|
- **Detail panel** — the remaining amount, this session's spend (`本会话花费`) with today's all-session spend beside it (`今日共花费`), one priced row per model (`缓存命中 ¥X · 未命中输入 ¥Y · 输出 ¥Z`), plus a manual refresh action and a spend disclaimer. The panel ends with a **today session-spend ranking**: sessions sorted by today's spend, highest first (names come from the log's Chinese titles and follow renames automatically; at most the top 10 rows, with a "…N more sessions" hint).
|
|
13
|
-
- **Turn cost row** — each completed turn's closing message shows
|
|
13
|
+
- **Turn cost row** — each completed turn's closing message shows `本轮花费 ¥X` at the **front** of the actions row (before the copy control): the "本轮花费" word in the usage-card title tone and the amount in the summary tone, **always visible** (not hover-revealed like the clock text); turns without DeepSeek usage (zero cost) or failed loads stay hidden.
|
|
14
14
|
- **Failures and empty states** — a session or day without priced usage shows "no usage recorded" instead of a fabricated figure; a missing key, rejected credential, or transport error renders a muted "Balance unavailable" whose tooltip carries the Remote's own error message.
|
|
15
15
|
|
|
16
16
|
## Data update mechanics
|
|
@@ -20,7 +20,14 @@ A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin tha
|
|
|
20
20
|
- **Old values survive refreshes** — a failed refresh keeps the last good value instead of blanking it.
|
|
21
21
|
|
|
22
22
|
## Preview
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
A real session: the session-header badge, the detail panel (remaining amount, this session's spend next to today's all-session spend, per-model breakdown, and the today session-spend ranking), plus the turn-cost row in the message actions row:
|
|
25
|
+
|
|
26
|
+
<img width="1200" alt="Billing plugin overview: session header badge, detail panel with per-model rows and today's session ranking, and the turn-cost row" src="preview-overview.png" />
|
|
27
|
+
|
|
28
|
+
Close-up of the turn-cost row — money-bag icon, `本轮花费` label and the `¥` amount, in front of the copy control:
|
|
29
|
+
|
|
30
|
+
<img width="640" alt="Turn-cost row close-up: money-bag icon, 本轮花费 label and ¥ amount before the copy control" src="preview-turn-cost.png" />
|
|
24
31
|
|
|
25
32
|
|
|
26
33
|
## Package layout
|
|
@@ -76,11 +83,11 @@ latest version right after a publish:
|
|
|
76
83
|
```
|
|
77
84
|
|
|
78
85
|
- Or, within the 24-hour window, install with an explicitly pinned version (an
|
|
79
|
-
explicit pin bypasses the age gate; replace `0.
|
|
86
|
+
explicit pin bypasses the age gate; replace `0.3.0` with the version you want;
|
|
80
87
|
from a source checkout, use `pnpm dsh …` as above):
|
|
81
88
|
|
|
82
89
|
```bash
|
|
83
|
-
dsh plugin --profile web add @rayadesu/dsh-billing@0.
|
|
90
|
+
dsh plugin --profile web add @rayadesu/dsh-billing@0.3.0 @rayadesu/dsh-llm-billing@0.3.0 @rayadesu/dsh-client-ui-billing@0.3.0
|
|
84
91
|
```
|
|
85
92
|
|
|
86
93
|
Manual rows (only when you do not want the bundle):
|
package/README.zh.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
- **会话头部徽标** —— 两行:剩余余额(`剩余额度:¥X`)+ 本轮对话的计费花费(`本轮对话花费:¥X`)。
|
|
12
12
|
- **详情面板** —— 剩余金额、本会话花费(`本会话花费`)与其右侧的今日所有会话共花费(`今日共花费`),以及每个模型一行的花费分项(`缓存命中 ¥X · 未命中输入 ¥Y · 输出 ¥Z`),外加手动刷新按钮与花费说明;面板底部是**今日会话花费排行**:按今日花费从高到低排列的会话列表(会话名取日志中的中文标题,重命名后自动同步;最多显示前 10 条,其余以「…还有 N 个会话」提示)。
|
|
13
|
-
- **本轮花费行** ——
|
|
13
|
+
- **本轮花费行** —— 每条已完成回合的收尾消息操作行**最前**(复制按钮之前)显示 `本轮花费 ¥X`:「本轮花费」一词用「本轮用量」卡片标题色、金额用卡片摘要色,**始终显示**(不随悬停隐藏,不同于时钟文本);回合没有 DeepSeek 用量(花费为 0)或加载失败时不显示。
|
|
14
14
|
- **失败与空态** —— 会话或今日没有可计价消耗时显示「暂无消耗记录」而不是编造数字;未配置 key、凭据被拒或传输错误时显示弱化的「额度不可用」,其提示携带 Remote 自己的错误信息。
|
|
15
15
|
|
|
16
16
|
## 数据更新机制
|
|
@@ -20,7 +20,14 @@
|
|
|
20
20
|
- **刷新期间旧值保留** —— 刷新失败保留上一次有效值,不会清空。
|
|
21
21
|
|
|
22
22
|
## 显示样式
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
真实会话中的会话头部徽标与详情面板(剩余金额、本会话花费与今日共花费、按模型分项、今日会话花费排行),以及消息操作行里的本轮花费行:
|
|
25
|
+
|
|
26
|
+
<img width="1200" alt="计费插件总览:会话头部徽标、详情面板(按模型分项与今日会话花费排行)、消息操作行里的本轮花费行" src="preview-overview.png" />
|
|
27
|
+
|
|
28
|
+
本轮花费行特写 —— 钱袋图标、`本轮花费` 标签与 `¥` 金额,位于复制控件之前:
|
|
29
|
+
|
|
30
|
+
<img width="640" alt="本轮花费行特写:钱袋图标、本轮花费标签与金额,位于复制控件之前" src="preview-turn-cost.png" />
|
|
24
31
|
|
|
25
32
|
|
|
26
33
|
## 包结构
|
|
@@ -70,11 +77,11 @@ dsh profile 通过 pnpm 安装插件,而 pnpm 11 的供应链发布龄门槛
|
|
|
70
77
|
minimumReleaseAge: 0
|
|
71
78
|
```
|
|
72
79
|
|
|
73
|
-
- 或者在 24 小时窗口内用**显式钉版本**安装(显式钉版本可绕开门槛,把 `0.
|
|
80
|
+
- 或者在 24 小时窗口内用**显式钉版本**安装(显式钉版本可绕开门槛,把 `0.3.0` 换成你要的版本;
|
|
74
81
|
源码构建的 dsh 用 `pnpm dsh …`,同上):
|
|
75
82
|
|
|
76
83
|
```bash
|
|
77
|
-
dsh plugin --profile web add @rayadesu/dsh-billing@0.
|
|
84
|
+
dsh plugin --profile web add @rayadesu/dsh-billing@0.3.0 @rayadesu/dsh-llm-billing@0.3.0 @rayadesu/dsh-client-ui-billing@0.3.0
|
|
78
85
|
```
|
|
79
86
|
|
|
80
87
|
手动补行(仅当不想用 bundle 时):
|
|
@@ -188,7 +195,7 @@ npm publish # @rayadesu/dsh-billing bundle(仓库根)
|
|
|
188
195
|
## 会话花费是怎么算的
|
|
189
196
|
|
|
190
197
|
- 每条 `assistant/message` 事件报告三个计费 token 桶:**缓存命中输入**、**未命中输入**(未缓存输入 + 缓存写入)、**输出**(含推理)。
|
|
191
|
-
-
|
|
198
|
+
- 每条消息按其**发生时刻**(北京时间)所在的峰/谷时段单价计价,三个桶分别计费(`缓存命中 ¥X · 未命中输入 ¥Y · 输出 ¥Z`),再按模型汇总。高峰窗口仅周一至周五适用;周末全天按低谷价计费。
|
|
192
199
|
- **今日共花费**按同一个计价规则汇总当天(北京时间自然日)所有会话的事件;事件归属的日期同样按北京时间计算。
|
|
193
200
|
- **本轮花费**按同一规则计价该回合 `turn/start`..`turn/end` 区间内的消息(定位到收尾消息的会话 id + 消息 id)。
|
|
194
201
|
- **今日会话花费排行**按同一规则按会话汇总今日花费(跨天会话只统计今天的部分),从高到低排序;会话名取日志中最后一条 `session/title` 事件(自动生成的中文标题或用户重命名的新标题)。
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rayadesu/dsh-billing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "DeepSeek Harness billing plugin: account balance and this session's billed spend with a session-header badge.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/rayadesune/DeepSeek-Harness-chat-billing.git"
|
|
9
|
+
},
|
|
7
10
|
"engines": {
|
|
8
11
|
"node": "^22.19 || >=24"
|
|
9
12
|
},
|
|
@@ -12,19 +15,13 @@
|
|
|
12
15
|
"patch": "./cordis.patch.yml"
|
|
13
16
|
}
|
|
14
17
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "pnpm run build:host && pnpm run build:client",
|
|
17
|
-
"build:host": "tsc -b tsconfig.host.json && tsdown --env.DSH_BUILD_FACE host",
|
|
18
|
-
"build:client": "tsc -b tsconfig.client.json && tsdown --env.DSH_BUILD_FACE client",
|
|
19
|
-
"typecheck": "tsc -b tsconfig.host.json && tsc -b tsconfig.client.json",
|
|
20
|
-
"test": "vitest run",
|
|
21
|
-
"verify": "node scripts/verify-packages.mjs"
|
|
22
|
-
},
|
|
23
18
|
"files": [
|
|
24
19
|
"cordis.patch.yml",
|
|
25
20
|
"README.md",
|
|
26
21
|
"README.zh.md",
|
|
27
22
|
"README.i18n.yaml",
|
|
23
|
+
"preview-overview.png",
|
|
24
|
+
"preview-turn-cost.png",
|
|
28
25
|
"LICENSE",
|
|
29
26
|
"AGENTS.md"
|
|
30
27
|
],
|
|
@@ -32,8 +29,8 @@
|
|
|
32
29
|
"access": "public"
|
|
33
30
|
},
|
|
34
31
|
"peerDependencies": {
|
|
35
|
-
"@rayadesu/dsh-
|
|
36
|
-
"@rayadesu/dsh-
|
|
32
|
+
"@rayadesu/dsh-client-ui-billing": "^0.3.1",
|
|
33
|
+
"@rayadesu/dsh-llm-billing": "^0.3.1"
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|
|
39
36
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
@@ -45,5 +42,13 @@
|
|
|
45
42
|
"tsdown": "^0.22.2",
|
|
46
43
|
"typescript": "^6.0.3",
|
|
47
44
|
"vitest": "^4.1.8"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "pnpm run build:host && pnpm run build:client",
|
|
48
|
+
"build:host": "tsc -b tsconfig.host.json && tsdown --env.DSH_BUILD_FACE host",
|
|
49
|
+
"build:client": "tsc -b tsconfig.client.json && tsdown --env.DSH_BUILD_FACE client",
|
|
50
|
+
"typecheck": "tsc -b tsconfig.host.json && tsc -b tsconfig.client.json",
|
|
51
|
+
"test": "vitest run",
|
|
52
|
+
"verify": "node scripts/verify-packages.mjs"
|
|
48
53
|
}
|
|
49
|
-
}
|
|
54
|
+
}
|
|
Binary file
|
|
Binary file
|