dsh-cost-widget
Manifest valid★ 1DSH Web GUI Floating Panel: Today's V4-Flash/Pro Average Cost Per Million Tokens and Cache Hit Rate
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
Comments
Loading…
From the same category
DeepSeek Harness plugin for Reactive Resume: bridges your resumes and job applications into a Harness session over MCP.
★ 41.7k
↓ 121/wk
MIT
Aug 24, 2026
dsh plugin --profile web add dsh-plugin-reactive-resumeby dsh-market
The plugin market inside DeepSeek Harness — browse, search, one-click install · DSH 可视化插件市场
★ 11.6k
↓ 321.4k/wk
MIT
TypeScript
Aug 25, 2026
dsh plugin --profile web add dshmarketby Tencent
Let AI agents use your real, logged-in browser without interrupting your work. CLI + extension for browser automation across any shell-capable AI agent.
★ 8.6k
↓ 15.4k/wk
MIT
TypeScript
Aug 25, 2026
dsh plugin --profile terminal add @wxg-prc-cpg/browser-skill-dsh-pluginby superdesigndev
OpenRouter for agent tools. Join community here: https://discord.gg/6mQYYfFMAn
★ 7.8k
NOASSERTION
Python
Aug 25, 2026
dsh plugin --profile web add treg-dshby yjh051108
dsh-routing-suite — injector + router-standard kit: install the runtime injector first, then the task-aware reasoning-mode router preset (measured P1-P23).
★ 7k
MIT
JavaScript
Aug 24, 2026
dsh plugin --profile web add @dsh-external/dsh-super-injectorby Q00
Agent OS: the agent gets smarter on its own. We just hold the line: Interview-gated, staged evaluation, budgeted evolution loop. MCP server, 14 runtimes: Claude Code, Codex CLI, Gemini CLI, OpenCode,
★ 6.2k
MIT
Python
Aug 25, 2026