ricardolicong/dsh-deepseek-quota ↗★ 0
dsh-deepseek-quota
DeepSeek API quota (balance) widget for the dsh web GUI: a floating wallet card showing remaining balance, today's official consumption and live conversation cost; banknotes blow out of the wallet while the agent is busy (fork of yingjunnan/dsh-deepseek-quota with a custom wallet UI).
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:ricardolicong/dsh-deepseek-quota说明文档
阅读完整 README ↗Configuration
The plugin reads the same API key the harness already uses: DEEPSEEK_API_KEY, resolved through the credentials service (set it on the Settings → Models page; it is stored in ~/.dsh/.credentials.yaml, or export it in the launching environment).
Today's consumption (今日已消费)
The official DeepSeek API exposes no usage query endpoint, so the widget uses two sources, in order:
-
Official (preferred) — the same date-filterable data the platform console shows. Configure the optional platform session token:
# get the token: log in to https://platform.deepseek.com, open DevTools → Console, run: # JSON.parse(localStorage.getItem('userToken')).value # then store it as a credential (e.g. add to ~/.dsh/.credentials.yaml): # DEEPSEEK_PLATFORM_TOKEN:With the token set, the host queries
platform.deepseek.com/api/v0/usage/cost?month=&year=and picks today's row. The card shows今日已消费 ¥X.XX. -
Estimate (fallback) — without the token, the host meters the balance (
max(0, day-opening balance − current)), persisted under~/.dsh/storages/deepseek-quota-day.json. The card shows今日约消费 ≈¥X.XXso it is never mistaken for an official figure. Note the official usage page can also be filtered to "today" — the platform token unlocks that same data.
No other configuration needed.
配置
插件读取的正是 harness 自己在用的那个 Key:DEEPSEEK_API_KEY(通过凭证服务解析;在 设置 → 模型 页面填写,存于 ~/.dsh/.credentials.yaml,或在启动环境中导出)。
今日消费(今日已消费)
DeepSeek 官方 API 没有开放用量查询接口,所以插件按优先级使用两种来源:
-
官方数据(优先)——与平台控制台相同的可按日期筛选的数据。需要配置可选的平台会话令牌:
# 获取令牌:登录 https://platform.deepseek.com,打开 DevTools → Console,执行: # JSON.parse(localStorage.getItem('userToken')).value # 然后把值写入凭证(例如追加到 ~/.dsh/.credentials.yaml): # DEEPSEEK_PLATFORM_TOKEN:配置后,宿主侧调用
platform.deepseek.com/api/v0/usage/cost?month=&year=并取"今天"那一行。卡片显示今日已消费 ¥X.XX。 -
估算(兜底)——未配置令牌时,宿主侧按余额差值估算(
max(0, 当天期初余额 − 当前余额),状态存于~/.dsh/storages/deepseek-quota-day.json)。卡片显示今日约消费 ≈¥X.XX,避免被误认为官方数字。
无需其它配置。