izz-BLUE/dsh-deepseek-usage-dashboard 预览 preview

izz-BLUE/dsh-deepseek-usage-dashboard

Plugin插件 Native原生 ⭐ 2 BSD-3-Clause Usage & Cost用量与计费

DeepSeek Harness Web UI插件,用于日常API令牌用量、费用估算和余额监控。

Project Overview项目介绍

This is a native installable Web UI plugin built exclusively for DeepSeek Harness (DSH). It tracks daily DeepSeek API token usage for your DSH instance, estimates daily API costs based on a user-configurable per-model pricing table, and monitors your DeepSeek account balance. To install the plugin, run dsh plugin --profile web add https://github.com/izz-BLUE/dsh-deepseek-usage-dashboard.git from your CLI, then restart dsh web to activate it. After installation, you will see an "API Usage" entry in your DSH sidebar, and a daily stats bar below the conversation composer. It is developed only using the official @deepseek-ai/* NPM SDK, and does not modify any core DSH source code.

The plugin only counts valid DeepSeek traffic that matches two conditions: the provider route ID is deepseek-official (configurable) and the request is sent to api.deepseek.com, so custom gateways will not pollute your usage stats. All usage is counted based on the Asia/Shanghai natural day, and only the final usage of a streaming request is stored to the database. It uses SQLite for persistent, idempotent storage with unique constraints that prevent duplicate counting even after restarts or projection replays. Corrupted database files are automatically moved out and rebuilt, so you do not need to manually fix them. Usage data is stored at ~/.dsh/deepseek-usage/usage.db by default.

Pricing uses a time-aware schedule system that assigns cost based on the start time of each request, and historical requests are never recalculated when you add or update pricing schedules. All cost estimates are clearly labeled as non-official estimates, and only the official DeepSeek bill is authoritative for billing purposes. The plugin follows strict security rules: your DeepSeek API key only exists in the host process, never enters the browser, logs, or request parameters. The plugin is open source under the permissive BSD-3-Clause license. It supports both Chinese and English locales out of the box.

这是一个可直接安装的DeepSeek Harness原生Web UI插件,核心功能是统计DSH实例每日DeepSeek Token用量,根据用户可编辑的分模型价格表估算当日费用,还支持监控DeepSeek账户余额。数据通过仪表盘、对话编辑器底部统计行和设置卡片展示,仅依赖官方@deepseek-ai/* NPM SDK开发,不修改DSH源码,全程不调用任何LLM接口。

统计范围严格限定为路由ID是deepseek-official且请求地址为api.deepseek.com的流量,自定义网关不会污染统计结果。用量统计按北京时间自然日划分,仅在最终用量到达后落库,采用SQLite持久化存储,幂等约束保证不会重复累计,重启后数据完整保留。

费用估算采用分时段分时定价,每个请求按发起时间计价,历史请求不会被新价格重算,所有金额明确标注为估算费用,仅供参考,不替代官方账单。API密钥仅存在于Host端进程,不进入浏览器、日志或请求参数,遵循严格的安全规范,采用BSD-3-Clause许可证开源。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add https://github.com/izz-BLUE/dsh-deepseek-usage-dashboard.git

把 izz-BLUE/dsh-deepseek-usage-dashboard 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-deepseek-usage-dashboard

简体中文 | English

一个独立、可安装的 DeepSeek Harness(DSH)Web UI 插件,用于:

  • 从会话日志统计本 DSH 实例每日 DeepSeek Token 用量(仅精确 usage:缓存命中/未命中输入、输出、推理);
  • 基于用户可编辑的分模型价格表估算今日费用;
  • 监控 DeepSeek 账户余额(仅 Host 端调用,默认每 10 分钟刷新,支持手动刷新);
  • 在 Web GUI 中以仪表盘、composer 底部统计行与设置卡片展示。

效果预览

DeepSeek API 用量仪表盘

仅基于官方 @deepseek-ai/* NPM SDK 开发;不修改任何 DSH 源码;通过 cordis.patch.yml + profile 插件机制安装。插件全程不调用任何 LLM 接口:统计、刷新、展示、余额查询零模型调用,空闲运行与刷新页面产生的 Token 为 0。

功能

  • 每日统计(Asia/Shanghai 自然日):缓存命中输入、缓存未命中输入、输出、推理(存在时)、输入合计、Token 合计、请求数、失败请求数、缓存命中率。
  • 只统计真实的 DeepSeek 流量:provider 路由为 deepseek-official(可配置)且有效 base URL 主机为 api.deepseek.com——自定义网关不会污染统计。
  • 流式安全:只有最终 usage 到达才落库;流式估算值从不写入每日精确统计。
  • 幂等 + 持久化:SQLite(Node 24 运行时内置 node:sqlite),UNIQUE (session_id, turn, step) 约束 + INSERT OR IGNORE——投影重放、流式 usage 重复到达、重启后重扫、重复提交均不会重复累计;跨重启保留;损坏文件自动移出并重建。
  • Decimal 金额:费用以整数最小单位(1e-6 币种单位)BigInt 累计,禁止浮点直接累计。时间感知计价:请求按开始时间选择生效的 PricingSchedule(effectiveFrom <= requestTime,含边界),支持分时段 band(如 peak/off-peak 窗口,start 含 / end 不含、可跨午夜);历史请求不会被后来新增的价格计划重算。未知模型明确记为「未计价」(不静默套用兜底价),显式配置 * 兜底仍可用;界面显示价格版本、更新时间与计价来源,所有金额明确标注为「估算费用,非官方账单」。
  • 余额:仅 Host 端 GET https://api.deepseek.com/user/balance(base URL 固定、10 秒超时、401/402/429/5xx/超时/畸形响应分别处理);失败时保留最后一次成功数据并显示 stale 状态;支持手动刷新。API Key 绝不进入浏览器、日志或请求参数。
  • Host HTTP 接口:/api/deepseek-usage/stats 与 /api/deepseek-usage/refresh,复用 DSH 浏览器信任篱笆(Host / Origin / Sec-Fetch-Site 校验,按官方 api-request-trust 语义实现)+ loopback 套接字校验;余额明细仅限 loopback;POST 要求 application/json;限制请求体大小;不提供任意 URL/文件/命令代理。
  • Web UI:侧边栏「API 用量」入口;仪表盘(今日卡片、缓存命中/未命中对比条、命中率、今日估算费用、余额(总额/赠送/充值)、最近 7 天趋势、最后更新时间、数据来源说明);conversation.composer.dock 紧凑统计行(今日:命中 X · 未命中 X · 输出 X · 估算 ¥X · 余额 ¥X);完整中英文 locale;仅使用 DSH CSS Token(适配亮/暗主题);不使用 dangerouslySetInnerHTML。

安装

dsh plugin --profile web add https://github.com/izz-BLUE/dsh-deepseek-usage-dashboard.git

重启 dsh web 后,侧边栏出现「API 用量」入口,composer 下方出现今日统计行。

本地开发可安装仓库检出目录:

dsh plugin --profile web add link:<本仓库路径>

如需纳入 dsh-web-ui-all 聚合包:把本包追加到 packages/dsh-web-ui-all/aggregate.yml(patchFrom 与 deps 两段),再运行 node scripts/aggregate.mjs。

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev DeepSeek-Harness-Desktop 下一个 Next dsh-memory →