dshbase

Plugin directory / UI & Skins / dsh-cost-widget

dsh-cost-widget

Verified · install-tested on dsh zhangshaobo608

✓ Actively maintained

View on GitHub ↗ ← Back to plugin directory

1Stars
0Forks
0Open issues
—Language
2026-08-18Last push
Cross-platformPlatform

What it does

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

✅
Our take
Works — verified, early-stage project

DSH Web GUI 悬浮面板:当天 V4-Flash/Pro 每百万 token 平均费用与缓存命中率 It installs cleanly and boots without issues in our testing. It's early-stage but functional.

“Verified” means our automated CI actually ran dsh plugin add in a clean profile and it booted — nothing more. Feature descriptions and version compatibility are the author’s claims. This is not a security audit and not an endorsement of third-party code.

README

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

Install

🧩 Let your agent install it (recommended)

Install the catalog once, then DeepSeek Harness can find and install any plugin from this site automatically:

dsh plugin add dshbase-catalog

Then say "install dsh-cost-widget for me" — your agent finds it in the directory and installs it. Docs: dshbase-catalog · verified packs.

This plugin is GitHub source (not published to npm) — install it straight from the repo:

Web profile:

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

Headless (CLI) profile:

dsh plugin --profile headless add github:zhangshaobo608/dsh-cost-widget

Test report

Verified: L1 install + L2 load + L3 runtime from GitHub source on dsh 0.1.0-rc.6.

Security: not yet scanned — our daily static scan will cover it shortly.

Share this badge

More in UI & Skins

Browse all 7819 plugins →