dsh-cost-meter 1.8.24 → 1.8.25
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 +7 -7
- package/README.zh-CN.md +6 -6
- package/docs/factory-quota.md +33 -0
- package/lib/client.js +5 -5
- package/lib/coding-plans.js +9 -1
- package/lib/factory-quota.js +69 -0
- package/lib/index.js +11 -0
- package/lib/plan-billing.js +6 -1
- package/lib/store.js +15 -0
- package/lib/typert.host.js +4 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
**Session cost tracking plugin for the DeepSeek Harness web GUI (bilingual UI)**
|
|
8
8
|
|
|
9
|
-
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; weekends and Chinese public holidays are off-peak all day, with separate labels) · pre-switch popup & system-notification alerts for peak/off-peak changes (position / lead time / alert type configurable) · one-click price sync from the official docs · Codex-style token usage heat grid · multi-vendor model pricing (built-in 170+ model-ID catalog with auto-matching) · mainstream Coding Plan quota queries & display (Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet / Volcano Ark / Qwen / Xiaomi MiMo) plan/API dual-track billing (subscription quota vs pay-as-you-go money separated, per-1% & full-window token/equivalent-cost estimates with daily/weekly/monthly curves) · · quota strip above the input box (budget / Go / coding-plan usage in one row, toggleable)
|
|
9
|
+
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; weekends and Chinese public holidays are off-peak all day, with separate labels) · pre-switch popup & system-notification alerts for peak/off-peak changes (position / lead time / alert type configurable) · one-click price sync from the official docs · Codex-style token usage heat grid · multi-vendor model pricing (built-in 170+ model-ID catalog with auto-matching) · mainstream Coding Plan quota queries & display (Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet / Volcano Ark / Qwen / Xiaomi MiMo / Factory Droid) plan/API dual-track billing (subscription quota vs pay-as-you-go money separated, per-1% & full-window token/equivalent-cost estimates with daily/weekly/monthly curves) · · quota strip above the input box (budget / Go / coding-plan usage in one row, toggleable)
|
|
10
10
|
|
|
11
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
12
12
|
|
|
13
|
-
**v1.8.
|
|
13
|
+
**v1.8.25** adds Factory (Droid) subscription quota windows: 5-hour, weekly and monthly, with separate Standard/Core pools, optional organization ID, secure credential storage and the existing quota strip. See the [Factory guide](docs/factory-quota.md#english).
|
|
14
14
|
|
|
15
15
|
Desktop users: follow the [Desktop installation instructions](docs/install-troubleshooting.md#desktop-安装与更新) for the application's own CLI and `desktop` Profile.
|
|
16
16
|
|
|
@@ -323,22 +323,22 @@ On Node.js 20, use `npm install -g pnpm@10` instead. See [pnpm installation and
|
|
|
323
323
|
dsh plugin --profile web add dsh-cost-meter
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
-
**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.8.
|
|
326
|
+
**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.8.25`** — review the script before running):
|
|
327
327
|
|
|
328
328
|
```powershell
|
|
329
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.
|
|
329
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.25/install.ps1 | iex
|
|
330
330
|
```
|
|
331
331
|
|
|
332
332
|
**Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
|
|
333
333
|
|
|
334
334
|
```sh
|
|
335
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.
|
|
335
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.25
|
|
336
336
|
```
|
|
337
337
|
|
|
338
338
|
Without git, use the GitHub tag archive:
|
|
339
339
|
|
|
340
340
|
```sh
|
|
341
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.
|
|
341
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.25.tar.gz
|
|
342
342
|
```
|
|
343
343
|
|
|
344
344
|
After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
|
package/README.zh-CN.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
本会话费用 · 当日费用 · OpenCode Go 订阅额度显示 · 预算与已用百分比 · 官方账户余额 · 自定义 Provider 余额查询(可配任意 HTTP 端点) · 余额三段进度条 · 历史记录 · 峰谷计价时段显示(UTC 01:00–04:00、06:00–10:00 为峰时段;周末与中国法定假日全天按谷价,分别标注) · 峰/谷切换前弹窗与系统通知提醒(位置/提前量/提醒类型可配) · 官方价格一键同步 · 类 Codex Token 用量热图 · 多厂商多模型价格计费(内置 170+ 模型 ID 价格目录与自动匹配) · 主流 Coding Plan 额度查询与显示(Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet / 火山方舟 / 千问 / 小米 MiMo 十一家,含 Volcano Ark AK/SK 签名与 MiMo 控制台 Cookie 查询) · Plan/API 双轨计费(订阅额度与按量金额分离统计,每 1% 额度与满窗的 token/等值金额估算及日/周/月曲线) · 输入框上方额度横条(预算/Go/Coding Plan 用量一条横排显示,可开关)
|
|
10
10
|
|
|
11
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
12
12
|
|
|
13
|
-
**v1.8.
|
|
13
|
+
**v1.8.25** 新增 Factory(Droid)订阅额度:5 小时、每周、每月,支持 Standard/Core 分开显示、可选组织 ID、DSH 凭据库及现有额度横条。详见 [Factory 使用说明](docs/factory-quota.md)。
|
|
14
14
|
|
|
15
15
|
桌面端用户请按 [Desktop 安装说明](docs/install-troubleshooting.md#desktop-安装与更新),使用应用自带的 CLI 和 `desktop` Profile。
|
|
16
16
|
|
|
@@ -323,22 +323,22 @@ Node.js 20 请改用 `npm install -g pnpm@10`。版本要求见 [pnpm 官方安
|
|
|
323
323
|
dsh plugin --profile web add dsh-cost-meter
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
-
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.8.
|
|
326
|
+
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.8.25`**,建议先下载审阅再运行):
|
|
327
327
|
|
|
328
328
|
```powershell
|
|
329
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.
|
|
329
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.25/install.ps1 | iex
|
|
330
330
|
```
|
|
331
331
|
|
|
332
332
|
**或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
|
|
333
333
|
|
|
334
334
|
```sh
|
|
335
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.
|
|
335
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.25
|
|
336
336
|
```
|
|
337
337
|
|
|
338
338
|
没有 git 时可用 GitHub tag 打包直链:
|
|
339
339
|
|
|
340
340
|
```sh
|
|
341
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.
|
|
341
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.25.tar.gz
|
|
342
342
|
```
|
|
343
343
|
|
|
344
344
|
安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Factory(Droid)订阅额度
|
|
2
|
+
|
|
3
|
+
在「设置 → 费用 → 额度」启用 **Factory (Droid)**。展开卡片后可设置额度类型、组织 ID、显示位置和刷新间隔。
|
|
4
|
+
|
|
5
|
+
- **Standard**:默认显示 5 小时、每周、每月三个已用百分比及重置时间。
|
|
6
|
+
- **Droid Core**:显示独立 Core 额度,同样包含三个窗口。
|
|
7
|
+
- **Standard + Core**:分别显示两套额度。输入框上方横条分为两个标签,各含三个窗口;点击任一标签刷新该账号额度。
|
|
8
|
+
|
|
9
|
+
## 凭据与组织
|
|
10
|
+
|
|
11
|
+
点击卡片中的「编辑凭据」,填写有权读取该账号额度的 Factory Bearer 凭据,保存到 DSH 凭据库的 `FACTORY_API_KEY`。也可由 DSH 进程读取同名环境变量。无须另加自定义 ref;凭据库命名与 `dsh-factory-provider` 的默认 `keyEnv` 一致。
|
|
12
|
+
|
|
13
|
+
`dsh-factory-provider` 自己账号库中选中的 key 不会自动复制到 DSH 凭据库。使用其账号时,需在本卡片存入对应凭据;组织 ID 可从该账号信息填写,未填写时不发送组织请求头。凭据失效或无权读取额度时显示认证提示,推理凭据是否可查额度由 Factory 接口决定。
|
|
14
|
+
|
|
15
|
+
凭据只写入 DSH 凭据库,既不回显也不保存到费用账本。关闭来源或将显示位置改为「关闭」即停止查询;组织、额度类型或凭据变化会清空旧缓存并取消旧请求。
|
|
16
|
+
|
|
17
|
+
## 查询与显示
|
|
18
|
+
|
|
19
|
+
只读 `GET https://api.factory.ai/api/billing/limits`,使用 `Authorization: Bearer …`、`x-client-version: 0.231.0`、`x-factory-client: cli` 和可选 `x-factory-org-id`。固定官方域名,拒绝重定向;15 秒单次请求超时,沿用网络重试和有界 JSON 读取。自动查询按卡片设置的 1–1440 分钟间隔缓存,默认 15 分钟;手动刷新立即查询。
|
|
20
|
+
|
|
21
|
+
`usedPercent` 已是 0–100 百分比,不乘以 100。优先使用 `windowEnd`,缺少有效绝对时间时使用 `secondsRemaining`;无重置字段时仍显示用量。缺失/无效窗口省略,不补造 0%;选择 Standard 时不偷偷回退到 Core。
|
|
22
|
+
|
|
23
|
+
账户百分比与 DSH 的调用记录分别统计。Factory 的 `factory-a`、`factory-g`、`factory-o` 归为同一套餐提供商;启用后可按既有 Plan/API 设置分类。由于本地记录无法逐次归属到 Standard/Core 池及其滚动周期,Factory 不生成每 1%/满窗 Token 与费用估算。
|
|
24
|
+
|
|
25
|
+
来源:[Factory 个人计划](https://docs.factory.ai/pricing/individuals)、[核验的提供商查询源码](https://github.com/Dalizi2026/dsh-factory-provider/blob/801c3a2be1927e804ad9e0e493c52e9aa13421df/lib/quota.js)。回归使用响应夹具与模拟网络,验证 DSH 服务、双端 codec、缓存、取消、落盘与真实 Chromium 界面;未使用真实付费账号验证。
|
|
26
|
+
|
|
27
|
+
## English
|
|
28
|
+
|
|
29
|
+
Enable **Factory (Droid)** under Settings → Cost → Quotas. Choose Standard (default), Droid Core, or both. Each pool has independent 5-hour, weekly and monthly windows. The sidebar shows all selected windows; the composer quota strip uses separate Standard/Core chips with three windows each. Either chip refreshes the Factory source.
|
|
30
|
+
|
|
31
|
+
Save a Factory Bearer credential with access to billing limits through the card's credential editor. It uses DSH's `FACTORY_API_KEY` credential ref or the same host environment variable. Keys selected in the provider plugin's private account store are not copied automatically. An optional organization ID scopes the request. Credentials are never echoed or stored in the ledger.
|
|
32
|
+
|
|
33
|
+
The adapter sends only a fixed read-only GET to the official billing-limits endpoint, rejects redirects, bounds response size and request time, and reuses the configured refresh cache. Disabling the source stops queries; credential, organization or pool changes cancel old work. Percentages are already on a 0–100 scale; reset time prefers `windowEnd`, then `secondsRemaining`. Missing windows remain absent. Account quota data does not become recorded DSH usage or a per-1% cost estimate without pool attribution. Tests use synthetic account data and network mocks plus real Chromium; no live paid account was queried.
|