brittanistrehlowll-oss/dsh-quota-panel ↗★ 2
dsh-quota-panel
Provider quota/balance corner panel for the dsh web surface: server-side credential proxies plus a config-driven page badge for DeepSeek balance and OpenCode Zen Go usage windows.
AI 分析
核心用途是在 Web 界面角落直观展示当前 API 密钥的剩余余额或使用窗口进度。适合需要实时监控 API 额度、避免因欠费或超限导致任务中断的用户。
インストール
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:brittanistrehlowll-oss/dsh-quota-panelドキュメント
README 全文を読む ↗Configuration
Each provider is one entry under providers. Two renderers ship:
| format | endpoint shape | row |
|---|---|---|
deepseek-balance | { "balance_infos": [{ "currency", "total_balance", "granted_balance", "topped_up_balance" }] } | ¥58.36 + 余额充足/正常/紧张/建议充值 |
opencode-usage | { "usage": { "rolling"|"weekly"|"monthly": { "percent", "resetsAt" } } } | 五 10% · 周 45% · 月 22% + progress bar + 当前最高占用 |
Override the shipped defaults in your profile's 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
Fields:
| field | meaning | default |
|---|---|---|
id | route id (/api/quota/), ^[a-z0-9-]+$ | required |
label | provider name on the card | required |
credential | credential reference ($DSH_HOME/.credentials.yaml or env) | required |
endpoint | quota JSON endpoint, GET with Authorization: Bearer | required |
format | row renderer | deepseek-balance |
balanceTiers | (deepseek-balance) {critical, warn, healthy} levels | {10, 20, 50} |
lowBalance | legacy alias for balanceTiers.warn | — |
windowLabels | (opencode-usage) {rolling, weekly, monthly} | {滚, 周, 月} |
warnPercent / errorPercent | (opencode-usage) thresholds | 70 / 90 |
refreshMs | auto-refresh interval | 60000 |
DeepSeek balance levels
With the default balanceTiers {critical: 10, warn: 20, healthy: 50}:
| balance | state | secondary line |
|---|---|---|
50 | ok | 余额充足 |
OpenCode usage states
high = max(rolling, weekly, monthly):
| usage | state |
|---|---|
= warnPercent | warn (amber dot + progress) |
>= errorPercent | error (red dot + progress) |
OpenCode usage states
high = max(rolling, weekly, monthly):
| usage | state |
|---|---|
= warnPercent | warn (amber dot + progress) |
>= errorPercent | error (red dot + progress) |