hurry060215-tech / dsh-api-usage-bar

Listed

Cache-aware API token usage bar for the DeepSeek Harness Web UI

mainToolSkill View source

Installation

npx -y @deepseek-ai/dsh plugin --profile web add github:hurry060215-tech/dsh-api-usage-bar

This installation command is an unverified starting point generated from the GitHub repository address.

README

Maintainer-authored documentation snapshot.

View on GitHub ↗
Commit b7e2b54Synced Aug 18, 2026

dsh-api-usage-bar

CI Release

English | 简体中文

适用于 DeepSeek Harness Web UI 的轻量 API token 用量条。它把完整会话的用量显示为三个分段:缓存输入未缓存输入输出,并在旁边给出紧凑数值。

DSH API 用量条

特点

  • 直接读取 DSH 已有的 tokenUsage 会话投影,不请求 DeepSeek API。
  • 不读取 API Key,不查询账号余额,不修改会话日志。
  • 绿色表示缓存读取,黄色表示未缓存输入,蓝色表示输出。
  • 鼠标悬停或辅助技术可以读取三个分段的精确 token 数量。
  • 桌面端和窄屏均可用;窄屏隐藏文字标签但保留颜色与数值。
  • 纯 UI 插件:不新增模型工具、system prompt 或 token 开销。

要求

  • DeepSeek Harness >=0.1.0-rc.6 <0.2.0
  • Web profile
  • Node.js ^22.19.0>=24
  • pnpm 10(dsh plugin 内部会调用它)

安装

在 PowerShell 中执行:

npm install --global pnpm@10
pnpm --version
npx --yes @deepseek-ai/dsh@0.1.0-rc.6 plugin --profile web add https://github.com/hurry060215-tech/dsh-api-usage-bar/releases/download/v0.1.1/dsh-api-usage-bar-0.1.1.tgz
npx --yes @deepseek-ai/dsh@0.1.0-rc.6 web

打开 http://127.0.0.1:3080。完成一次模型请求后,用量条会自动出现在输入框下方。安装包包含预构建的 lib/,用户不需要克隆仓库或运行构建。

插件尚未发布到 npm;不要使用 add dsh-api-usage-bar。上面的命令直接安装 GitHub Release 中的预构建包。

3080 端口已被占用

如果 3080 上已经运行着 DSH,先在原来的终端按 Ctrl+C 停止它,再执行上面的 web 命令,使新插件在重启后加载。如果 3080 被其他程序占用,可以改用:

npx --yes @deepseek-ai/dsh@0.1.0-rc.6 web --port 3091

然后打开 http://127.0.0.1:3091。检查端口占用程序:

Get-NetTCPConnection -LocalPort 3080 -State Listen |
  Select-Object LocalAddress, LocalPort, OwningProcess

卸载:

npx --yes @deepseek-ai/dsh@0.1.0-rc.6 plugin --profile web remove dsh-api-usage-bar

统计口径

分段DSH token 投影字段
缓存输入cacheReadTokens
未缓存输入uncachedInputTokens + cacheWriteTokens
输出outputTokens

三个分段按 token 总数归一化,所以条形图表达的是用量构成,不是账号额度或余额进度。DeepSeek 的请求 usage 会报告提示词缓存命中与未命中 token;余额接口没有提供总额度分母,因此本插件不会虚构“已用百分比”。

开发

pnpm install
pnpm run check       # typecheck + tests + build
pnpm pack            # 生成可离线安装的 tarball

源码结构:

  • src/index.ts:Host 端空插件,用于客户端模块发现。
  • src/client/index.ts:locale、样式和 composer dock 注册。
  • src/client/ApiUsageBar.tsx:用量条与紧凑图例。
  • src/client/usage.ts:token 分桶与格式化纯函数。
  • cordis.patch.yml:由 dsh.bundle 自动激活的 profile 配置层。

隐私与模型体验

插件只读取浏览器已收到的累计 token 投影。它不发起网络请求,不持有凭据,不写会话事件,也不会改变发送给模型的任何内容。

License

MIT

Project files and signals

Shown items are public repository signals detected in the directory snapshot.

TestsDetected
DocumentationDetected

Repository information

Language
TypeScript
License
MIT
Latest release
v0.1.1
Last updated
Aug 14, 2026, 8:39 AM

Install deliberately

Review source code, permissions, lifecycle hooks, dependencies and network access. Test untrusted plugins in an isolated environment.