Skip to content

dsh-usage-quota

Verified

@yuuu0109/dsh-usage-quota · v0.1.1 · MIT · Web UI

DeepSeek Harness web plugin for model usage, balance quota, and daily token display

Install

dsh plugin add @yuuu0109/dsh-usage-quota

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Tags

Readme

dsh-usage-quota

一个 DeepSeek Harness Web 插件,用于在模型设置之外配置用量与额度查询,并在左侧侧边栏设置按钮上方显示剩余额度与今日消耗 Token。

功能

  • 设置页新增“用量查询”模块,DeepSeek 官方余额只配置一次,不按模型拆分。
  • DeepSeek 官方查询使用 GET {baseURL}/user/balance,自动读取模型设置中的 Base URL 与 API Key。
  • 查询配置优先写入 DSH settings namespace;旧 Host 尚未加载该 namespace 时自动使用浏览器本地配置,仍可立即配置和显示。
  • 全局自动查询间隔为 1 到 1440 分钟。
  • Token 显示可在完整数字与 K/M 缩写之间切换,偏好按浏览器本地保存。
  • 左下角显示 DeepSeek 官方剩余额度和今日 Token;今日 Token 明细按实际请求模型显示。
  • 今日 Token 从持久化会话事件重算,重启后不会丢失,跨午夜自动切日。

安装

dsh plugin --profile web add @yuuu0109/dsh-usage-quota

重启 dsh web 并刷新浏览器。

更新

dsh plugin --profile web update @yuuu0109/dsh-usage-quota

重启 dsh web 并刷新浏览器。如果配置的 npm 镜像尚未同步最新版本,可指定官方源:

dsh plugin --profile web update @yuuu0109/dsh-usage-quota --registry=https://registry.npmjs.org/

pnpm 11 可能延迟 24 小时同步新版本,需要立即更新时可执行:

dsh plugin --profile web update @yuuu0109/dsh-usage-quota --config.minimumReleaseAge=0

从源码安装

git clone https://github.com/Yuuu0109/dsh-usage-quota.git
cd dsh-usage-quota
pnpm install
pnpm build
dsh plugin --profile web add .

卸载

dsh plugin --profile web remove @yuuu0109/dsh-usage-quota

重启 dsh web

使用

  1. 打开“设置”中的“用量查询”。
  2. 开启“在侧边栏显示”,设置自动查询间隔。
  3. DeepSeek 官方模型直接测试即可。
  4. 自定义网关可填写 URL 模板和剩余字段路径,例如:
URL: {{baseUrl}}/dashboard/billing/credit_grants
Header: Authorization: Bearer {{apiKey}}
剩余字段路径: total_available

保存后,左下角会自动按配置间隔刷新。

开发

pnpm typecheck
pnpm test
pnpm build

兼容 DeepSeek Harness 0.1.0-rc.8 与 React 18。

这是独立社区插件,不属于官方 DeepSeek Harness 仓库。