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等服务余额与用量的用户。

パッケージ
dsh-quota-panel
互換性
未検証
バージョン
0.8.0
ライセンス
MIT
最終更新
2026/09/24

同名パッケージの別リポジトリ

インストール

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:brittanistrehlowll-oss/dsh-quota-panel

ドキュメント

README 全文を読む ↗

配置

每个提供方是 providers 下的一项,内置三种渲染器:

format接口返回形态行显示
deepseek-balance{ "balance_infos": [{ "currency", "total_balance" }] }余额 ¥58.36
opencode-usage{ "usage": { "rolling"|"weekly"|"monthly": { "percent", "resetsAt" } } }最高窗口用量 86%
command-costendpoint 为 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 50ok

OpenCode 用量状态

high = max(滚动, 每周, 每月):

用量状态
= warnPercentwarn(琥珀点)
>= errorPercenterror(红点)

某个窗口的 percent 缺失或不是有限数值时,整行判定为数据异常,绝不折叠成 0%。

Command Code 费用状态

high = max(本周期消费占比, 五小时窗口, 周窗口):

读数状态
= warnPercentwarn(琥珀)
>= errorPercenterror(红)

月比例使用官方 /alpha/usage/summary 的 totalMonthlyCredits 与 /alpha/billing/credits 的 credits.monthlyCredits,在 periodBasis=billing-period 时按 月度已消耗 / (月度已消耗 + 月度剩余) 计算。充值和赠送额度不混入月比例;字段缺失显示 —。五小时、周比例来自 windowLimits.used/cap。本周期额度接口并不直接返回,由 消费 + 剩余额度 反推 —— GOAT 套餐实测为 $16.24 + $53.77 = $70.01。月重置日期接口未返回时不编造。