@lyk308/dsh-token-dashboard 0.1.1 → 0.1.3
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 +64 -60
- package/README.zh.md +64 -60
- package/docs/screenshot.png +0 -0
- package/docs/screenshot2.png +0 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,60 +1,64 @@
|
|
|
1
|
-
# dsh-token-dashboard
|
|
2
|
-
|
|
3
|
-
[](https://awesome-dsh-plugin.com)
|
|
4
|
-
|
|
5
|
-
A DeepSeek Harness plugin that puts your **real-time account balance** and **token usage** on one dashboard. Local-first: reads your DSH session logs and the DeepSeek `/user/balance` API. No cloud account beyond your existing DeepSeek key.
|
|
6
|
-
|
|
7
|
-
## Screenshots
|
|
8
|
-
|
|
9
|
-

|
|
10
|
-
|
|
11
|
-
](https://awesome-dsh-plugin.com)
|
|
4
|
+
|
|
5
|
+
A DeepSeek Harness plugin that puts your **real-time account balance** and **token usage** — including **cost estimation** — on one dashboard. Local-first: reads your DSH session logs and the DeepSeek `/user/balance` API. No cloud account beyond your existing DeepSeek key.
|
|
6
|
+
|
|
7
|
+
## Screenshots
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- 💰 **Account balance** — live balance from the DeepSeek official `/user/balance` API (CNY/USD aware), with force-refresh.
|
|
16
|
+
- 📊 **Token usage** — Today / This month / All-time cards, plus request count, cache hit rate, and session count.
|
|
17
|
+
- 💵 **Cost estimation** — accurate DeepSeek pricing (peak/off-peak aware), per-model cost, and Today / This month / All-time spend.
|
|
18
|
+
- 📈 **Usage distribution** — toggle between **by model** and **by workspace**, with a proportional share bar (top 8 + "other" aggregate). Percentages match the bar exactly.
|
|
19
|
+
- 📉 **Daily trend** — an SVG line chart of daily cost or tokens (30/90/180-day switch).
|
|
20
|
+
- 🗓 **Activity heatmap** — 30 / 90 / 180 day switch, green-shade intensity maps token usage.
|
|
21
|
+
- 🤖 **Model breakdown** — a table of Req / Input / Cache / Output / Cost per model.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
This is a standard DSH bundle plugin, so install it with the official CLI:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# From GitHub
|
|
29
|
+
dsh plugin --profile web add github:lyk308/dsh-token-dashboard
|
|
30
|
+
|
|
31
|
+
# From npm
|
|
32
|
+
dsh plugin --profile web add @lyk308/dsh-token-dashboard
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
After installing, **refresh the web UI**. The dashboard appears under **Settings → 用量看板** (Usage Dashboard).
|
|
36
|
+
|
|
37
|
+
> Note: the plugin reads the DeepSeek API key from DSH's credentials service (`DEEPSEEK_API_KEY`). Without a valid key the balance card shows a hint instead of a number; token usage still works because it comes from local session logs.
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
1. Open **Settings → 用量看板**.
|
|
42
|
+
2. Refresh the server to load the latest data at any time.
|
|
43
|
+
3. Switch between **by model / by workspace**, the **30 / 90 / 180-day** heatmap ranges, and the **cost / token** trend metric.
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
The plugin mostly works with no configuration. The host half resolves sensible defaults in `lib/index.js`:
|
|
48
|
+
|
|
49
|
+
- `sessionsRoot` — defaults to `$DSH_HOME/sessions`.
|
|
50
|
+
- `balanceCacheMs` — balance cache TTL (default 300000 ms = 5 min).
|
|
51
|
+
- `sweepIntervalMs` — stats refresh interval (default 60000 ms).
|
|
52
|
+
|
|
53
|
+
> Cost estimation uses DeepSeek's official V4 pricing (CNY per 1,000,000 tokens) with peak/off-peak billing: peak = Mon–Fri 09:00–12:00 & 14:00–18:00. Prices are defined in `MODEL_PRICES` in `lib/index.js` and can be edited as DeepSeek changes them.
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
- `lib/index.js` — host half: session scanning (multi-frame zstd), token aggregation, cost estimation, balance proxy.
|
|
58
|
+
- `lib/client.js` — client half: the settings.section UI, trend chart, and cost display.
|
|
59
|
+
|
|
60
|
+
Edit `lib/client.js` → refresh the page to see changes. Edit `lib/index.js` → restart the DSH web profile.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
[MIT](./LICENSE)
|
package/README.zh.md
CHANGED
|
@@ -1,60 +1,64 @@
|
|
|
1
|
-
# dsh-token-dashboard
|
|
2
|
-
|
|
3
|
-
[](https://awesome-dsh-plugin.com)
|
|
4
|
-
|
|
5
|
-
一个 DeepSeek Harness
|
|
6
|
-
|
|
7
|
-
## 效果预览
|
|
8
|
-
|
|
9
|
-

|
|
10
|
-
|
|
11
|
-
](https://awesome-dsh-plugin.com)
|
|
4
|
+
|
|
5
|
+
一个 DeepSeek Harness 插件,把**实时账户余额**、**Token 使用量**和**成本估算**整合在一个看板上。本地优先:读取你的 DSH 会话日志 + DeepSeek 官方 `/user/balance` 接口,无需额外云端账号(沿用你已有的 DeepSeek key)。
|
|
6
|
+
|
|
7
|
+
## 效果预览
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## 功能
|
|
14
|
+
|
|
15
|
+
- 💰 **账户余额** — 通过 DeepSeek 官方 `/user/balance` 接口实时获取(自动识别 CNY/USD),支持强制刷新。
|
|
16
|
+
- 📊 **Token 使用量** — 今日 / 本月 / 总计三卡,加请求数、缓存命中率、会话数。
|
|
17
|
+
- 💵 **成本估算** — 精确的 DeepSeek 定价(区分峰谷时段),按模型成本,以及 今日/本月/总计 花费。
|
|
18
|
+
- 📈 **用量分布** — 在**按模型**和**按工作区**之间切换,带比例占比条(前 8 项 + 「其他」聚合),百分比与占比条完全一致。
|
|
19
|
+
- 📉 **每日趋势** — SVG 折线图展示每日成本或 Token(30 / 90 / 180 天切换)。
|
|
20
|
+
- 🗓 **活跃度热力图** — 30 / 90 / 180 天切换,绿色深浅映射 Token 用量。
|
|
21
|
+
- 🤖 **按模型明细** — 每个模型的 Req / Input / Cache / Output / Cost 表格。
|
|
22
|
+
|
|
23
|
+
## 安装
|
|
24
|
+
|
|
25
|
+
这是一个标准 DSH bundle 插件,用官方 CLI 安装:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 从 GitHub 安装
|
|
29
|
+
dsh plugin --profile web add github:lyk308/dsh-token-dashboard
|
|
30
|
+
|
|
31
|
+
# 从 npm 安装
|
|
32
|
+
dsh plugin --profile web add @lyk308/dsh-token-dashboard
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
安装后**刷新网页**即可。看板位于 **设置 → 用量看板**。
|
|
36
|
+
|
|
37
|
+
> 说明:插件从 DSH 的凭据服务读取 DeepSeek API Key(`DEEPSEEK_API_KEY`)。没有有效 key 时余额卡片显示引导文案;Token 用量仍可正常统计(来自本地会话日志)。
|
|
38
|
+
|
|
39
|
+
## 使用方法
|
|
40
|
+
|
|
41
|
+
1. 打开 **设置 → 用量看板**。
|
|
42
|
+
2. 随时刷新服务器加载最新数据。
|
|
43
|
+
3. 切换 **按模型 / 按工作区**、**30 / 90 / 180 天**热力图范围,以及 **成本 / Token** 趋势指标。
|
|
44
|
+
|
|
45
|
+
## 配置
|
|
46
|
+
|
|
47
|
+
插件基本无需配置即可使用,host 半在 `lib/index.js` 里解析合理默认值:
|
|
48
|
+
|
|
49
|
+
- `sessionsRoot` — 默认为 `$DSH_HOME/sessions`。
|
|
50
|
+
- `balanceCacheMs` — 余额缓存时长(默认 300000 毫秒 = 5 分钟)。
|
|
51
|
+
- `sweepIntervalMs` — 统计刷新间隔(默认 60000 毫秒)。
|
|
52
|
+
|
|
53
|
+
> 成本估算使用 DeepSeek 官方 V4 定价(元/百万 tokens),按峰谷计费:高峰 = 周一至周五 09:00-12:00、14:00-18:00。价格定义在 `lib/index.js` 的 `MODEL_PRICES`,可随 DeepSeek 调价而修改。
|
|
54
|
+
|
|
55
|
+
## 开发
|
|
56
|
+
|
|
57
|
+
- `lib/index.js` — host 半:会话扫描(多帧 zstd)、Token 聚合、成本估算、余额代理。
|
|
58
|
+
- `lib/client.js` — client 半:settings.section 界面、趋势图、成本显示。
|
|
59
|
+
|
|
60
|
+
改 `lib/client.js` → 刷新页面即可看到变化。改 `lib/index.js` → 重启 DSH web profile。
|
|
61
|
+
|
|
62
|
+
## 许可证
|
|
63
|
+
|
|
64
|
+
[MIT](./LICENSE)
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lyk308/dsh-token-dashboard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "DeepSeek Harness 实时看板:账户余额 + Token 使用量(按模型/工作区/缓存命中),本地读取会话日志 + DeepSeek /user/balance。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -26,7 +26,11 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"lib/index.js",
|
|
28
28
|
"lib/client.js",
|
|
29
|
-
"cordis.patch.yml"
|
|
29
|
+
"cordis.patch.yml",
|
|
30
|
+
"README.md",
|
|
31
|
+
"README.zh.md",
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"docs"
|
|
30
34
|
],
|
|
31
35
|
"keywords": [
|
|
32
36
|
"deepseek-harness",
|