dsh-cost-meter 1.5.5 → 1.5.6
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 +5 -5
- package/README.md +5 -5
- package/lib/coding-plans.js +35 -3
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Per-conversation cost · daily totals · OpenCode Go subscription quota display · budget with usage percentage · official account balance · custom provider balance · balance progress bar · history · peak/off-peak pricing hours display (peak hours UTC 01:00–04:00, 06:00–10:00) · one-click price sync from the official docs · Codex-style token usage heat grid · multi-vendor model pricing (built-in 90+ model price catalog with auto-matching) · mainstream Coding Plan quota queries & display (Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow)
|
|
8
8
|
|
|
9
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
10
10
|
[](LICENSE)
|
|
11
11
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
12
12
|
[](https://awesome-dsh-plugin.com)
|
|
@@ -184,22 +184,22 @@ Real captures from an actual DSH sidebar of the period strip and collapsed verti
|
|
|
184
184
|
|
|
185
185
|
### One-click install (recommended)
|
|
186
186
|
|
|
187
|
-
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.5.
|
|
187
|
+
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.5.6`** — review the script before running):
|
|
188
188
|
|
|
189
189
|
```powershell
|
|
190
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.5.
|
|
190
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.5.6/install.ps1 | iex
|
|
191
191
|
```
|
|
192
192
|
|
|
193
193
|
**Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
|
|
194
194
|
|
|
195
195
|
```sh
|
|
196
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.5.
|
|
196
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.5.6
|
|
197
197
|
```
|
|
198
198
|
|
|
199
199
|
Without git, use the GitHub tag archive:
|
|
200
200
|
|
|
201
201
|
```sh
|
|
202
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.5.
|
|
202
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.5.6.tar.gz
|
|
203
203
|
```
|
|
204
204
|
|
|
205
205
|
After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
本会话费用 · 当日费用 · OpenCode Go 订阅额度显示 · 预算与已用百分比 · 官方账户余额 · 自定义 Provider 余额查询(可配任意 HTTP 端点) · 余额三段进度条 · 历史记录 · 峰谷计价时段显示(UTC 01:00–04:00、06:00–10:00 为峰时段) · 官方价格一键同步 · 类 Codex Token 用量热图 · 多厂商多模型价格计费(内置 90+ 模型价格目录与自动匹配) · 主流 Coding Plan 额度查询与显示(Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow 六家)
|
|
8
8
|
|
|
9
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
10
10
|
[](LICENSE)
|
|
11
11
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
12
12
|
[](https://awesome-dsh-plugin.com)
|
|
@@ -186,22 +186,22 @@
|
|
|
186
186
|
|
|
187
187
|
### 一键安装(推荐)
|
|
188
188
|
|
|
189
|
-
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.5.
|
|
189
|
+
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.5.6`**,建议先下载审阅再运行):
|
|
190
190
|
|
|
191
191
|
```powershell
|
|
192
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.5.
|
|
192
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.5.6/install.ps1 | iex
|
|
193
193
|
```
|
|
194
194
|
|
|
195
195
|
**或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
|
|
196
196
|
|
|
197
197
|
```sh
|
|
198
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.5.
|
|
198
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.5.6
|
|
199
199
|
```
|
|
200
200
|
|
|
201
201
|
没有 git 时可用 GitHub tag 打包直链:
|
|
202
202
|
|
|
203
203
|
```sh
|
|
204
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.5.
|
|
204
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.5.6.tar.gz
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
|
package/lib/coding-plans.js
CHANGED
|
@@ -144,15 +144,47 @@ export function parseZaiUsage(data) {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
* 解析 MiniMax
|
|
148
|
-
* - Token Plan:GET https://www.minimaxi.com|io/v1/token_plan/remains
|
|
149
|
-
*
|
|
147
|
+
* 解析 MiniMax 用量响应。兼容三种官方形态:
|
|
148
|
+
* - Token Plan(2026-08 现行,issue #20):GET https://www.minimaxi.com|io/v1/token_plan/remains
|
|
149
|
+
* 平铺结构——根节点(或 data.data)直接含 current_interval_*(5小时固定窗)与
|
|
150
|
+
* current_weekly_*(周窗)字段,无窗口数组;status=3 表示不限量,不展示该窗;
|
|
151
|
+
* - Token Plan(旧数组形态):窗口数组字段,条目含 total/used/remain 与 interval 标签;
|
|
150
152
|
* - Coding Plan(旧计数制):GET .../v1/api/openplatform/coding_plan/remains
|
|
151
153
|
* { model_remains: [{ current_interval_total_count, current_interval_usage_count, ... }] }。
|
|
152
154
|
*/
|
|
153
155
|
export function parseMiniMaxRemains(data) {
|
|
154
156
|
if (data === null || typeof data !== 'object') return null
|
|
155
157
|
const windows = {}
|
|
158
|
+
const payload = data.data !== null && typeof data.data === 'object' && !Array.isArray(data.data) ? data.data : data
|
|
159
|
+
// 平铺窗口字段(现行形态,issue #20):优先计数推导,其次剩余百分比反推。
|
|
160
|
+
const clampPct = p => Math.max(0, Math.min(100, Math.round(p * 10) / 10))
|
|
161
|
+
const usedPercentOf = (totalKey, usedKey, remainKey, remainPctKey) => {
|
|
162
|
+
const total = Number(payload[totalKey])
|
|
163
|
+
const used = Number(payload[usedKey])
|
|
164
|
+
const remain = Number(payload[remainKey])
|
|
165
|
+
if (Number.isFinite(total) && total > 0) {
|
|
166
|
+
if (Number.isFinite(used)) return (used / total) * 100
|
|
167
|
+
if (Number.isFinite(remain)) return ((total - remain) / total) * 100
|
|
168
|
+
}
|
|
169
|
+
// *_remaining_percent 是剩余百分比(<=1 视为比例),反推已用。
|
|
170
|
+
const rp = Number(payload[remainPctKey])
|
|
171
|
+
if (Number.isFinite(rp)) return 100 - Math.min(100, Math.max(0, rp <= 1 ? rp * 100 : rp))
|
|
172
|
+
return null
|
|
173
|
+
}
|
|
174
|
+
// status=3 = 不限量:进度条无意义,跳过该窗(与 OpenClaw 同策略)。
|
|
175
|
+
if (Number(payload.current_interval_status) !== 3) {
|
|
176
|
+
const intervalPct = usedPercentOf('current_interval_total_count', 'current_interval_usage_count', 'current_interval_remain_count', 'current_interval_remaining_percent')
|
|
177
|
+
if (intervalPct !== null) {
|
|
178
|
+
windows['5h'] = { percent: clampPct(intervalPct), resetsAt: normalizeResetAt(payload.end_time ?? payload.reset_time ?? payload.next_reset_time) }
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (Number(payload.current_weekly_status) !== 3) {
|
|
182
|
+
const weeklyPct = usedPercentOf('current_weekly_total_count', 'current_weekly_usage_count', 'current_weekly_remain_count', 'current_weekly_remaining_percent')
|
|
183
|
+
if (weeklyPct !== null) {
|
|
184
|
+
windows.week = { percent: clampPct(weeklyPct), resetsAt: normalizeResetAt(payload.weekly_end_time) }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (Object.keys(windows).length > 0) return windows
|
|
156
188
|
const pickArray = (...keys) => {
|
|
157
189
|
for (const key of keys) {
|
|
158
190
|
const direct = Array.isArray(data?.[key]) ? data[key] : null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cost-meter",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6",
|
|
4
4
|
"description": "DeepSeek Harness 会话费用统计插件:本会话成本、当日费用、历史记录与官方价格同步,支持多厂商多模型价格计费(内置 90+ 模型价格目录与自动匹配)、主流 Coding Plan 订阅额度查询与显示(6 家)、自定义 Provider 余额查询(可配任意 HTTP 端点)与余额进度条,界面中英双语。Session cost tracking plugin for DeepSeek Harness: per-conversation cost, daily totals, history and official price sync, with multi-vendor model pricing (built-in 90+ model catalog with auto-matching), Coding Plan quota queries & display for 6 vendors, custom provider balance lookup (configurable HTTP endpoint) and balance progress bar, in a bilingual (Chinese/English) UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|