xavier711/dsh-plugin-deepseek-usage:給 DSH Web GUI 增加 DeepSeek 用量面板

前言

如果你已經在使用 DeepSeek Harness(DSH)Web GUI,又希望在一處查看 DeepSeek 賬戶餘額和本地會話用量,xavier711/dsh-plugin-deepseek-usage 是一個面向 Web GUI 的用量面板插件。它在左側欄底部增加「Usage / 用量」入口,把餘額查詢、本地 token 統計和費用估算放在同一個面板裏。

這是什麼

  • 插件名:xavier711/dsh-plugin-deepseek-usage
  • 維護者:xavier711
  • 許可證:MIT
  • 運行環境:DSH Web GUI,需要 Node.js
  • 一句話定位:爲 DSH Web GUI 增加 DeepSeek 用量面板。

核心功能

下面介紹它能直接顯示的內容。

賬戶餘額

支持配置 DeepSeek API key 後,即時查詢官方 GET /user/balance 賬戶餘額,字段包括 total、topped-up、granted。

如果沒有 API key,本地用量統計仍可用,餘額卡只顯示提示。

本地用量統計

DeepSeek API 未暴露賬戶級用量端點(資料稱所有候選路徑實際返回 404),所以本地用量數據來自本地會話日誌。插件會重放本地會話日誌中的官方每請求 usage 記錄,並顯示:

  • 今日、最近 7 天、全時段統計
  • 7 天圖表
  • 今日 token 構成
  • 按模型統計
  • 按 workspace 統計

費用估算

插件按模型以官方 DeepSeek 價格(CNY per 1M tokens)估算費用,並應用:

  • 2026-08-17 V4 峯谷計價
  • 2026-08-23 週末全天 off-peak 規則

側欄入口和麪板頭部會顯示當前峯/off-peak 指示、活躍時間窗口及下一次切換。

安裝與啓用

先確認已安裝 Node.js。下面幾種安裝方式任選其一。

方式一:從 GitHub 安裝(推薦)

dsh plugin --profile web add git+https://github.com/xavier711/dsh-deepseek-usage.git#v0.4.2

如果本機沒有全局 dsh,可以用:

npx --yes @deepseek-ai/dsh plugin --profile web add git+https://github.com/xavier711/dsh-deepseek-usage.git#v0.4.2

如果安裝器提示缺少 pnpm,先運行:

npm install -g pnpm

然後重試原安裝命令。

方式二:npm 安裝

dsh plugin --profile web add @xavier711/dsh-deepseek-usage

方式三:克隆安裝

git clone https://github.com/xavier711/dsh-deepseek-usage.git
cd dsh-deepseek-usage
./install.sh

安裝後啓用

1、在運行 dsh web 的終端中停止服務,然後重新運行 dsh web;如果沒有全局 dsh,可以用 npx --yes @deepseek-ai/dsh web。

2、刷新瀏覽器頁面,必要時做硬刷新。

完成後,「用量」入口會出現在側欄底部、Settings 上方。

因爲插件通過 dsh.bundle 自動激活,通常不需要手動改配置。

可選配置

API key

如果要顯示餘額卡,可以在 ~/.dsh/.credentials.yaml 中寫:

DEEPSEEK_API_KEY: sk-xxxx

或者設置環境變量:

DEEPSEEK_API_KEY

無 key 時,本地用量統計仍可用;餘額卡顯示提示。

覆蓋行配置

按需可在 ~/.dsh/profiles/web/cordis.patch.yml 中通過 id: deepseek-usage 覆蓋配置。已列出的配置項包括:

balanceTtlMs
maxSessions
sessionConcurrency
balanceTimeoutMs
localTtlMs
newPricingAt
weekendOffPeakAt
peakHours

具體取值請按你的運行環境設置。

更新、卸載與排查

npm 安裝更新

dsh plugin --profile web update @xavier711/dsh-deepseek-usage

Git 安裝更新

Git 安裝爲固定快照,更新不自動。插件會在打開用量面板時查詢 GitHub releases feed(小時級緩存),並顯示新版本的準確更新命令。

執行更新命令後,需要重啓 dsh web 並刷新頁面。

卸載

dsh plugin --profile web remove @xavier711/dsh-deepseek-usage

然後重啓 dsh web 並刷新頁面。

常見問題

如果看到警告 declares no dsh.bundle,說明安裝了舊快照。按 pinned tag 重裝:

dsh plugin --profile web remove @xavier711/dsh-deepseek-usage
dsh plugin --profile web add git+https://github.com/xavier711/dsh-deepseek-usage.git#v0.4.2

然後重啓 dsh web 並刷新頁面。

如果「用量」入口沒有出現在安裝後,先確認 dsh web 已重啓,並刷新或硬刷新瀏覽器頁面。

適用場景與注意

這個插件適合已經使用 DSH Web GUI,並且希望同時查看 DeepSeek 餘額和本地會話用量的場景。

需要注意:

  • 插件以當前 dsh 進程權限運行,安裝前應檢查源碼和許可證。
  • API key 不會被內嵌到插件中;運行時從本機 ~/.dsh/.credentials.yaml 或環境變量解析,並且只在 host 端使用,瀏覽器 bundle 不接觸。
  • 資料中的截圖數字均爲合成樣例數據,不表示真實餘額、key、token 或會話內容。

鏈接

GitHub 倉庫:https://github.com/xavier711/dsh-plugin-deepseek-usage

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜