@shi-yangyang/dsh-token-dashboard 0.2.0 → 0.2.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.en.md +6 -5
- package/README.md +6 -5
- package/client/client.js +1185 -954
- package/lib/shared/builtin-prices.d.ts +10 -1
- package/lib/shared/builtin-prices.generated.d.ts +1 -1
- package/lib/shared/builtin-prices.generated.js +479 -95
- package/lib/shared/builtin-prices.js +25 -1
- package/lib/shared/pricing.d.ts +2 -0
- package/lib/shared/pricing.js +14 -1
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -44,7 +44,7 @@ The plugin never writes a session log, changes a model request, or uploads sessi
|
|
|
44
44
|
- **Range-aware trends** — today, last 7 / 30 / 90 days, all time, or a custom date range; KPIs and the Usage chart share the same range.
|
|
45
45
|
- **Models and sessions** — searchable, filterable, sortable tables with pagination and a session detail drawer.
|
|
46
46
|
- **Request log** — one row per billed request, with time, app, provider, model, new input, output, cache hit, cost, speed, and first-token latency.
|
|
47
|
-
- **Cost estimates** — a built-in
|
|
47
|
+
- **Cost estimates** — a built-in 453-model priced OpenRouter snapshot plus hand-maintained DeepSeek peak rates; override any price on the dedicated **Rates** page, or refresh from OpenRouter on demand.
|
|
48
48
|
- **Native and local-first** — DSH slots, DSH theme tokens, English/中文 UI, same-origin read-only routes, and exports that strip the working directory.
|
|
49
49
|
|
|
50
50
|
## Quick start
|
|
@@ -86,13 +86,14 @@ Updating Host code requires a DSH restart; Client-only changes need a page refre
|
|
|
86
86
|
| **Models** | Token distribution and request counts by provider/model |
|
|
87
87
|
| **Sessions** | Search, filters, sorting, pagination, and per-session detail |
|
|
88
88
|
| **Request log** | Individual billed requests, 12 per page, newest first |
|
|
89
|
-
| **Costs** | Estimated spend, per-model breakdown,
|
|
89
|
+
| **Costs** | Estimated spend, per-model breakdown, and online price refresh |
|
|
90
|
+
| **Rates** | Dedicated editor for every built-in model price; saved overrides immediately affect cost estimates |
|
|
90
91
|
|
|
91
92
|
The header provides the language switch, scan interval, **Sync now**, and export. Scan interval controls local session polling: **5 / 10 / 30 / 60 seconds**. All list tables show up to 12 rows per page with compact natural row heights; pagination stays at the footer and no list introduces an inner scrollbar.
|
|
92
93
|
|
|
93
94
|
Request-log cost is calculated with the current pricing table in the browser; unpriced models show `—`. Speed is output tokens divided by the measured request window. First-token latency runs from `step/start` to the first stream record; requests without stream timing show `—`.
|
|
94
95
|
|
|
95
|
-
Prices are estimates, not provider invoices. The built-in DeepSeek rates are peak-hour prices; off-peak rates are approximately half.
|
|
96
|
+
Prices are estimates, not provider invoices. The built-in DeepSeek rates are peak-hour prices; off-peak rates are approximately half. Edit any model rate on the **Rates** page; overrides and online price cache live in the browser's `localStorage`.
|
|
96
97
|
|
|
97
98
|
## Architecture
|
|
98
99
|
|
|
@@ -103,7 +104,7 @@ flowchart LR
|
|
|
103
104
|
Host --> Fold[Token fold + revision cache]
|
|
104
105
|
Fold --> Routes[Read-only same-origin JSON]
|
|
105
106
|
Routes --> Client[React dashboard in DSH slots]
|
|
106
|
-
Client --> Views[Overview · Models · Sessions · Requests · Costs]
|
|
107
|
+
Client --> Views[Overview · Models · Sessions · Requests · Costs · Rates]
|
|
107
108
|
```
|
|
108
109
|
|
|
109
110
|
- **Host** (`src/host`) reads the official session store, folds usage incrementally, handles pricing, and serves the dashboard API. The cache is in memory and keyed by session revision (or live sequence); there is no second database or ledger.
|
|
@@ -154,7 +155,7 @@ Issues and pull requests are welcome. Run `pnpm typecheck` and `pnpm test` befor
|
|
|
154
155
|
- Covers the active DSH profile's local session store only; remote, cloud, and other-profile sessions are not included.
|
|
155
156
|
- The first dashboard open scans history into an in-memory cache. A DSH restart starts fresh; there is no persistent index.
|
|
156
157
|
- Request speed and first-token latency depend on recorded stream timestamps. Older logs, or requests without streams, show `—`.
|
|
157
|
-
- Cost is a list-price estimate in USD, not a bill. The
|
|
158
|
+
- Cost is a list-price estimate in USD, not a bill. The OpenRouter snapshot is dated **2026-11-09** (eight variable-price auto-router models are intentionally left unpriced and show `—`); online refresh and user overrides can change the displayed estimate.
|
|
158
159
|
- Session navigation depends on the optional `uiWorkspace.openSession` host service.
|
|
159
160
|
|
|
160
161
|
## License
|
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ Host 端通过官方 `sessionPersistence` 服务读取会话日志,并使用
|
|
|
44
44
|
- **时间范围联动**:今天、最近 7 / 30 / 90 天、全部时间或自定义日期范围;KPI 与 Usage 图表使用同一范围。
|
|
45
45
|
- **模型与会话**:可搜索、筛选、排序的分页表格,以及会话详情抽屉。
|
|
46
46
|
- **请求日志**:按每次计费请求展示时间、应用、供应商、模型、新增输入、输出、缓存命中、成本、速度和首字耗时。
|
|
47
|
-
- **费用估算**:内置
|
|
47
|
+
- **费用估算**:内置 453 个可定价 OpenRouter 模型快照与 DeepSeek 高峰价;可在独立的 **单价** 页覆盖任意单价,也可按需从 OpenRouter 刷新。
|
|
48
48
|
- **原生与本地优先**:DSH Slot、主题 Token、中英文界面、同源只读路由;导出时自动去掉工作目录。
|
|
49
49
|
|
|
50
50
|
## 快速开始
|
|
@@ -86,13 +86,14 @@ plugin_manager(action: "install_bundle", target: "/absolute/path/to/dsh-token-da
|
|
|
86
86
|
| **模型** | 按供应商/模型统计的 Token 分布与请求数 |
|
|
87
87
|
| **会话** | 搜索、筛选、排序、分页和会话详情 |
|
|
88
88
|
| **请求日志** | 逐条计费请求,每页 12 条,最新在前 |
|
|
89
|
-
| **费用** |
|
|
89
|
+
| **费用** | 预估总费用、逐模型明细与在线价目刷新 |
|
|
90
|
+
| **单价** | 独立的模型单价编辑页,包含全部内置价目;保存后立即影响费用估算 |
|
|
90
91
|
|
|
91
92
|
顶部提供语言切换、扫描间隔、**立即同步**和导出。扫描间隔控制本地会话轮询:**5 / 10 / 30 / 60 秒**。所有列表每页最多 **12 行**,行高保持紧凑,分页位于卡片底部,不引入卡片或表格滚动条。
|
|
92
93
|
|
|
93
94
|
请求日志的成本按浏览器中的当前价目即时计算,未定价模型显示 `—`。速度 = 输出 Token / 实测请求窗口;首字 = `step/start` 到首个 stream record 的时间,没有 stream 时间戳时显示 `—`。
|
|
94
95
|
|
|
95
|
-
费用只是估算,不是 provider 账单。内置 DeepSeek
|
|
96
|
+
费用只是估算,不是 provider 账单。内置 DeepSeek 单价为高峰价,非高峰约为一半。可在 **单价** 页编辑任意模型单价;单价覆盖和在线价目缓存保存在浏览器 `localStorage`。
|
|
96
97
|
|
|
97
98
|
## 架构
|
|
98
99
|
|
|
@@ -103,7 +104,7 @@ flowchart LR
|
|
|
103
104
|
Host --> Fold[Token fold + revision 缓存]
|
|
104
105
|
Fold --> Routes[只读同源 JSON]
|
|
105
106
|
Routes --> Client[DSH Slot 内的 React 看板]
|
|
106
|
-
Client --> Views[概览 · 模型 · 会话 · 请求日志 · 费用]
|
|
107
|
+
Client --> Views[概览 · 模型 · 会话 · 请求日志 · 费用 · 单价]
|
|
107
108
|
```
|
|
108
109
|
|
|
109
110
|
- **Host**(`src/host`)读取官方会话存储、增量折叠用量、处理价目并提供看板 API。缓存只在内存中,按会话 revision 或 live sequence 维护;没有第二个数据库或账本。
|
|
@@ -154,7 +155,7 @@ scripts 构建、测试、真实会话校验
|
|
|
154
155
|
- 只覆盖当前 DSH profile 的本地会话存储;远程、云端和其他 profile 的会话不包含在内。
|
|
155
156
|
- 首次打开会把历史扫描进内存缓存。DSH 重启后缓存清空,没有持久化索引。
|
|
156
157
|
- 请求速度和首字依赖日志中的 stream 时间戳;旧日志或没有 stream 的请求显示 `—`。
|
|
157
|
-
- 费用是以 USD
|
|
158
|
+
- 费用是以 USD 计的列表价估算,不是账单。OpenRouter 快照日期为 **2026-11-09**(OpenRouter 另有 8 个无固定单价的自动路由模型,显示为 `—`);在线刷新和用户覆盖会改变估算结果。
|
|
158
159
|
- 会话跳转依赖可选的 `uiWorkspace.openSession` 宿主服务。
|
|
159
160
|
|
|
160
161
|
## 许可证
|