Back to home

TiferKing

dsh-usage-indicator

简约的余额指示器,一眼看尽 DeepSeek 用量。上下文余量、账户余额、压缩倒计时,全部在侧边栏顶部。

Stars
0
Language
TypeScript
Created
Aug 17, 2026
Updated
Aug 17, 2026

Introduction

dsh-usage-indicator

CI

Screenshot1

DSH(DeepSeek Harness)Web 侧边栏插件:实时显示上下文余量账户余额预计下次上下文压缩轮次。数据本地闭环,API Key 不离开本机。

功能

  • 上下文占用 / 模型窗口进度条,接近压缩阈值变黄、达到变红
  • 账户余额进度条,低于警示线整条变红
  • 「N 轮后压缩」EMA 估算,数据不足显示"评估中"
  • Web 设置面板可调整满条额度与警示线,热生效
  • 侧边栏收起时为紧凑圆环 + 余额状态点

安装

前置:已安装 DSH 与 pnpm(缺 pnpm 先执行 npm install -g pnpm)。

方式一:Release 包(推荐)

dsh plugin --profile web add C:\path\to\dsh-usage-indicator-<version>.tgz

方式二:源码安装(clone 即用,内置 lib/ 无需构建)

git clone https://github.com/TiferKing/dsh-usage-indicator.git
dsh plugin --profile web add .\dsh-usage-indicator

安装后重启 dsh web 生效;更新用新包再执行一次 add;卸载:dsh plugin --profile web remove dsh-usage-indicator

使用与配置

默认读取环境变量 DEEPSEEK_API_KEY 查余额,侧边栏顶部实时显示卡片;收起侧边栏自动切换为圆环视图。Web 设置面板「API 用量指示」可修改满条额度与警示线,写入 settings.yaml 热生效。

字段默认值说明
apiKeyEnvDEEPSEEK_API_KEY余额接口的凭证引用
baseURL$DEEPSEEK_BASE_URLhttps://api.deepseek.com余额接口基址(自定义网关时配置)
refreshIntervalMs60000host 轮询周期(毫秒),下限 30 秒
thresholdRatio0.8上下文压缩阈值,需与 dsh-compaction-basic 保持一致
fullBalance100资金条满条金额
warnBalance20余额低于该值时资金条变红

开发

npm install
npm run build      # 产出 lib/index.js + lib/client.js
npm run typecheck  # 类型检查
npm test           # 运行测试(需 Node ≥ 22.18)

结构:src/index.ts(host:轮询 + /api/usage-indicator 路由)、src/client.tsx(侧边栏卡片与设置页)、src/balance.ts(余额解析)、test/。欢迎提交 Issue 与 PR。

License

MIT