brittanistrehlowll-oss/dsh-quota-panel ↗★ 3
dsh-quota-panel
Minimal draggable quota capsule: one-line readings, two-line expanded view and a persistent position lock. 适合需要实时、直观监控DeepSeek等服务余额与用量的用户。
Other repositories with this package name
Install
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:brittanistrehlowll-oss/dsh-quota-panelREADME
Read the full README ↗配置
每个提供方是 providers 下的一项,内置三种渲染器:
| format | 接口返回形态 | 行显示 |
|---|---|---|
deepseek-balance | { "balance_infos": [{ "currency", "total_balance" }] } | 余额 ¥58.36 |
opencode-usage | { "usage": { "rolling"|"weekly"|"monthly": { "percent", "resetsAt" } } } | 最高窗口用量 86% |
command-cost | endpoint 为 API 根;宿主合并三个接口读数 | 本期费用 $16.24 |
在 profile 的 cordis.patch.yml 中覆盖默认配置:
- id: quota-panel
config:
refreshMs: 30000
providers:
- id: deepseek
label: DeepSeek
credential: DEEPSEEK_API_KEY
endpoint: https://api.deepseek.com/user/balance
format: deepseek-balance
balanceTiers: { critical: 10, warn: 20, healthy: 50 }
- id: opencode-go
label: OpenCode Go
credential: OPENCODE_GO_API_KEY
endpoint: https://opencode.ai/zen/go/v1/usage
format: opencode-usage
windowLabels: { rolling: 五, weekly: 周, monthly: 月 }
warnPercent: 70
errorPercent: 90
- id: command
label: Command Code
credential: COMMAND_API_KEY
endpoint: https://api.commandcode.ai
format: command-cost
windowLabels: { fiveHour: 五, weekly: 周 }
warnPercent: 70
errorPercent: 90
currency: USD
字段说明:
| 字段 | 含义 | 默认值 |
|---|---|---|
id | 路由 id(/api/quota/),^[a-z0-9-]+$ | 必填 |
label | 卡片上的提供方名称 | 必填 |
credential | 凭据引用($DSH_HOME/.credentials.yaml 或环境变量) | 必填 |
endpoint | 额度 JSON 接口(command-cost 填 API 根),GET + Authorization: Bearer | 必填 |
format | 行渲染器 | deepseek-balance |
balanceTiers | (deepseek-balance){critical, warn, healthy} 分级阈值 | {10, 20, 50} |
lowBalance | 旧版别名,等价于 balanceTiers.warn | — |
windowLabels | (opencode-usage){rolling, weekly, monthly};(command-cost){fiveHour, weekly} | 按界面语言 |
warnPercent / errorPercent | (opencode-usage、command-cost)阈值 | 70 / 90 |
currency | (command-cost)金额货币,三位 ISO 码 | USD |
refreshMs | 自动刷新间隔,5000 50 | ok |
OpenCode 用量状态
high = max(滚动, 每周, 每月):
| 用量 | 状态 |
|---|---|
= warnPercent | warn(琥珀点) |
>= errorPercent | error(红点) |
某个窗口的 percent 缺失或不是有限数值时,整行判定为数据异常,绝不折叠成 0%。
Command Code 费用状态
high = max(本周期消费占比, 五小时窗口, 周窗口):
| 读数 | 状态 |
|---|---|
= warnPercent | warn(琥珀) |
>= errorPercent | error(红) |
月比例使用官方 /alpha/usage/summary 的 totalMonthlyCredits 与 /alpha/billing/credits 的 credits.monthlyCredits,在 periodBasis=billing-period 时按 月度已消耗 / (月度已消耗 + 月度剩余) 计算。充值和赠送额度不混入月比例;字段缺失显示 —。五小时、周比例来自 windowLimits.used/cap。本周期额度接口并不直接返回,由 消费 + 剩余额度 反推 —— GOAT 套餐实测为 $16.24 + $53.77 = $70.01。月重置日期接口未返回时不编造。