DeepSeek Harness plugin

dsh-cost-widget

DSH Web GUI 悬浮面板:当天 V4-Flash / V4-Pro 每百万 token 平均费用与缓存命中率

Jump to install

Source facts

Repository
zhangshaobo608/dsh-cost-widget
Latest update
Aug 18, 2026
Category
UI Enhancements
GitHub stars
1
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/zhangshaobo608/dsh-cost-widget
Plugin: dsh-cost-widget
Author: zhangshaobo608

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

dsh-cost-widget

DeepSeek Harness(DSH)Web GUI 客户端插件:可拖拽的悬浮浮窗(紧凑悬浮条 ⇄ 完整面板),实时展示你 DeepSeek 开放平台账号当天的:

  • V4-Flash / V4-Pro:每 100 万 token 的平均费用(= 当天成本 ÷ 当天 token 数 × 100 万)
  • 缓存命中率(含进度条)、今日消耗、请求数、今日总成本、总命中率、余额
  • 头部"峰时/闲时"标识(北京时间 9:00–12:00、14:00–18:00 为峰时)

默认形态是右下角的紧凑悬浮条(DeepSeek ¥x · 命中率 · 峰/闲);点击展开完整面板,按住标题栏可拖到任意位置(位置记忆在 localStorage),每 5 分钟自动刷新,也可手动 ↻。挂载在 Web GUI 侧栏底部动作区(sidebar.footer.action 插槽)。

> 姊妹项目:zhangshaobo608/deepseek-widget —— 同样的指标,macOS 桌面浮窗版(不依赖 DSH)。

安装

需要 DSH web profile(@deepseek-ai/dsh >= 0.1.0-rc.6):

dsh plugin --profile web add "github:zhangshaobo608/dsh-cost-widget"

重启 dsh web(或触发热重载),浏览器硬刷新(Cmd+Shift+R)后面板出现在右下角。

更新 / 卸载:

dsh plugin --profile web update dsh-cost-widget
dsh plugin --profile web remove dsh-cost-widget

配置凭证(一次性)

插件通过 harness 凭证管道读取平台会话 token,添加:

# 在 ~/.dsh/.credentials.yaml 中追加一行(值可从浏览器获取,见下)
# DEEPSEEK_PLATFORM_TOKEN: <userToken>

获取 userToken:Chrome 登录 platform.deepseek.com → F12 → Console 执行(copy() 会把 token 直接放进剪贴板,无需手动选中输出):

copy(JSON.parse(localStorage.getItem('userToken')).value)

然后 Cmd+V 粘贴。也可存成书签一键复制(在 platform.deepseek.com 页面上点一下):

javascript:(()=>{const v=JSON.parse(localStorage.getItem('userToken')).value;navigator.clipboard.writeText(v).then(()=>alert('token 已复制'))})()

复制输出的长串(以 eyJ 开头)。也可用环境变量 DEEPSEEK_PLATFORM_TOKEN 注入(优先级更高)。

数据来源与安全

  • 数据来自 platform.deepseek.com/api/v0/usage/by_api_key/{amount,cost}/users/get_user_summary —— 与官方用量页同一个内部 JSON API,不是爬网页
  • 插件只在本机注册一个只读、仅回环接口 GET /api/dsh-cost/today(非本机调用直接 403),token 在请求时经凭证管道解析,不落盘、不回显
  • 公开 API key(api.deepseek.com)只有 /user/balance,没有用量统计,所以用量必须用平台会话 token。

开发

npm run check   # 语法检查 lib/*
npm run test    # platform.js 纯函数测试(合成数据断言)
  • lib/index.js — host 端 cordis 插件(代理 + 聚合)
  • lib/platform.js — 纯函数:时间范围、解析、聚合(可单测)
  • lib/client.js — 浏览器端 __ModuleLoader__ bundle(React 面板)

License

MIT