返回目录
其他 插件

dsh-usage-monitor

M1kasssa/dsh-usage-monitor

该仓库暂未提供项目说明。

Stars
2
Forks
0
Issues
0
更新
2 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:M1kasssa/dsh-usage-monitor

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

dsh-usage-monitor

一个为 DeepSeek Harness 网页界面 打造的毛玻璃(iOS Liquid Glass 风格)小部件,显示在侧边栏左下角「设置」按钮旁边,实时展示你的 DeepSeek 开放平台余额与 API 用量

  • 🐋 DeepSeek 鲸鱼图标胶囊:余额 + 本月累计 tokens,每 60 秒自动刷新
  • 💎 iOS Liquid Glass 风格(折射渐变、高光光泽、渐变描边),支持亮色 / 暗色模式
  • 📊 详情弹窗:余额(总额 / 赠送额度 / 充值额度)、本月 tokens(缓存命中输入 / 未命中输入 / 输出)、请求次数
  • 💰 一键充值:余额旁边的「充值」按钮,直接跳转到 DeepSeek 官方充值页(https://platform.deepseek.com/top_up
  • ⚡ 无需构建、无需 npm install、无需 git —— 与 Aqua 主题插件相同的安装机制

重要:插件包含 Host 半区(一个本地代理路由),它只在 dsh web 进程启动时加载。仅刷新页面不够 —— 安装后必须重启进程(安装脚本会提醒你)。

截图

插件界面截图

安装(Windows)

一条命令,在任何目录下执行:

powershell -ExecutionPolicy Bypass -Command "Invoke-WebRequest 'https://github.com/M1kasssa/dsh-usage-monitor/raw/main/install.ps1' -OutFile install.ps1; .\install.ps1"

或者手动克隆:

git clone https://github.com/M1kasssa/dsh-usage-monitor.git
powershell -ExecutionPolicy Bypass -File .\install.ps1 -Source .\dsh-usage-monitor

脚本会:

  1. 将仓库下载到 %USERPROFILE%\.dsh\plugins\@deepseek-ai\dsh-client-ui-dsusage
  2. %USERPROFILE%\.dsh\profiles\node_modules\@deepseek-ai\dsh-client-ui-dsusage 创建目录联接(junction)
  3. %USERPROFILE%\.dsh\profiles\web\cordis.patch.yml 中注册 ui-dsusage(幂等,可重复执行)

可覆盖参数:-DshHome <路径>(默认 %USERPROFILE%\.dsh)、-Profile <名称>(默认 web)、-Version <标签|分支>

手动安装(任意系统)

# 1. 将本仓库复制到 DSH 插件目录
mkdir -p "$DSH_HOME/plugins/@deepseek-ai"
cp -r dsh-usage-monitor "$DSH_HOME/plugins/@deepseek-ai/dsh-client-ui-dsusage"

# 2. 链接到 profile 的 node_modules
ln -s "$DSH_HOME/plugins/@deepseek-ai/dsh-client-ui-dsusage" "$DSH_HOME/profiles/node_modules/@deepseek-ai/dsh-client-ui-dsusage"

# 3. 在 profiles/web/cordis.patch.yml 中注册
- insert:
    - id: ui-dsusage
      name: '@deepseek-ai/dsh-client-ui-dsusage'

⚠️ 需要重启

安装完成后,请完全重启 dsh web 进程

# 在运行 dsh 的终端里按 Ctrl+C,然后重新运行
npx @deepseek-ai/dsh web --port 3080

如果进程还在运行旧代码,胶囊按钮依然会出现(浏览器半区是热加载的),但用量不可用 —— 弹窗会显示红色警告提示你重启。如果看到该警告,请重启进程。

使用方法

  1. 点击侧边栏左下角的鲸鱼胶囊按钮(首次运行会自动打开)。
  2. 粘贴你的 DeepSeek API Key(在 https://platform.deepseek.com/api_keys 创建)并按回车。
    • 余额立即显示(官方接口 api.deepseek.com/user/balance,允许跨域,由浏览器直接请求)。
    • 点击余额旁边的「充值」按钮,即可跳转到官方充值页进行充值。
  3. (可选,用于用量数据)提供平台 Token
    • 登录 https://platform.deepseek.com,打开开发者工具(F12)→ Console,执行:
      localStorage.getItem('userToken')

      返回的是一个 JSON 字符串,形如 {"value":"PIAD…","__version":"0"} —— 复制其中的 value

    • 把它粘贴到弹窗的第二个输入框并按回车,或者写入 Host 半区会读取的文件:
      %USERPROFILE%\.dsh\ds-usage-token.txt
    • 之后每 60 秒会通过 Host 半区注册的本地代理路由(/ds-usage/v1/usage),从私有看板接口 platform.deepseek.com/api/v0/usage/amount?month=&year= 拉取用量。仅凭 API Key 无法查询用量 —— 看板接口需要平台会话 Token。

平台用量接口是私有、未公开文档化的接口,可能随时变化。如果用量停止更新,请提 issue。

工作原理

浏览器(Client 半区)
├─ 余额: fetch https://api.deepseek.com/user/balance  (API Key,允许跨域)
├─ 用量: fetch http://127.0.0.1:3080/ds-usage/v1/usage (同源代理路由)
└─ UI:   sidebar.footer.action / shell.overlay 插槽中的胶囊按钮 + 弹窗

Node(Host 半区,lib/index.js)
└─ GET /ds-usage/v1/usage → curl platform.deepseek.com/api/v0/usage/amount
   (模拟浏览器请求头;Token 来自 ?token= 覆盖参数或 $DSH_HOME/ds-usage-token.txt)

两个半区都在同一个包内:lib/index.js 是 Host 入口,lib/client.js 是浏览器入口(在 package.json 中通过 dsh.client 声明),与 Aqua 主题插件完全一致。

卸载

# 删除目录联接(切勿加 -Recurse,否则会删掉插件目录本体)
[System.IO.Directory]::Delete("$env:USERPROFILE\.dsh\profiles\node_modules\@deepseek-ai\dsh-client-ui-dsusage")
# 删除插件目录
Remove-Item "$env:USERPROFILE\.dsh\plugins\@deepseek-ai\dsh-client-ui-dsusage" -Recurse -Force
# 从 profiles\web\cordis.patch.yml 中移除对应行
# 重启 dsh web

隐私

  • API Key 只保存在浏览器 localStorage 中,仅发送给 api.deepseek.com(Key 的目标服务)。
  • 平台 Token 只保存在你的机器上:从本地存储/文件中读取,仅通过本地代理发送给 platform.deepseek.com
  • 不会向任何其他地方发送任何数据。

许可证

MIT

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类其他
规则置信度

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。