DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

ChrisZhangWG /

dsh-codex-meter

Verified

Native Settings → Usage dashboard for DeepSeek Harness: balance, official token and cost analysis, trends, context warnings, and API activity.

★ 1 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@dbe24edd

dsh-codex-meter

DeepSeek API 用量监控插件(DSH web GUI):原生 Settings → Usage 页面,实时显示账户余额与今日已消费。界面全部为英文。

Settings → Usage 页面

功能

  • Settings → Usage 原生页面(设置 → 通用 → Usage),不再是右下角悬浮胶囊
  • 只显示两项数据,均为英文标签:
    • Account balance — DeepSeek API 剩余余额(官方 /user/balance,实时准确)
    • Today — 今日已消费(配置平台 token 后为官方数据;否则 ≈ 本地估算)
  • 不显示会话级费用:Usage 页面刻意不包含 session 级指标
  • View full usage on DeepSeek Platform 按钮:打开 DeepSeek 平台用量页(明细 + 充值)
  • 窗口隐藏/最小化时暂停轮询,恢复可见立即补刷;数值无变化时不触发重渲染
  • 平台 token 过期/失效时,Today 行标签变为 Today (refresh needed),不会静默退回估算
  • 只使用 --dsw-* 主题变量,跟随浅色 / 深色模式与应用字号缩放
  • API Key 不出本机:浏览器只访问宿主本地路由

安装(桌面版手动方式)

本插件按 DSH 标准 bundle 插件设计(dsh.bundle.patch + dsh.client),正常可用 dsh plugin --profile <name> add dsh-codex-meter 安装。桌面版(DSH Desktop 2.x)的手动接线方式:

  1. 将本包放入 profile 的 node_modules:

    PROFILE=~/.dsh/profiles/desktop
    mkdir -p "$PROFILE/node_modules"
    cp -R dsh-codex-meter "$PROFILE/node_modules/"
    
  2. 桌面版 profile 的 node_modules 为空,插件的宿主依赖需软链到桌面自带 bundle:

    mkdir -p "$PROFILE/node_modules/@deepseek-ai"
    ln -sfn "/Applications/DSH Desktop.app/Contents/Resources/app.asar.unpacked/node_modules/@deepseek-ai/dsh-credentials" \
      "$PROFILE/node_modules/@deepseek-ai/dsh-credentials"
    
  3. 在 $PROFILE/cordis.patch.yml 追加 loader 条目:

    - insert:
        - id: codex-meter
          name: dsh-codex-meter
    
  4. 完全重启 DSH Desktop(退出再打开)。重启后进入 Settings → Usage 查看。

若用 CLI 版 dsh web:profile 自带完整 pnpm workspace,直接 dsh plugin --profile web add dsh-codex-meter 即可,无需手动接线。

配置

  • 余额读取复用 DEEPSEEK_API_KEY(设置 → 模型,或 ~/.dsh/.credentials.yaml)。

  • 「今日已消费」官方来源(推荐):配置 DEEPSEEK_PLATFORM_TOKEN (登录 platform.deepseek.com → DevTools → Console → JSON.parse(localStorage.getItem('userToken')).value), 存到 ~/.dsh/.credentials.yaml:

    DEEPSEEK_PLATFORM_TOKEN: <token>
    

    配置后 Today 显示官方精确数据;token 会随平台会话过期,失效时 Today 行显示 Today (refresh needed) 并自动退回 ≈ 估算(数据落 ~/.dsh/storages/codex-meter-day.json), 重新按上述步骤取新 token 即可恢复。

宿主路由

路由 说明
GET /api/codex-meter/balance 余额 + 今日已消费(官方优先,估算兜底)+ platformTokenStatus(Usage 页面使用)
GET /api/codex-meter/session-cost?sessionId= 会话费用:日志回放计价(宿主保留,Usage 页面不使用)

开发

git clone <fork>
cd dsh-codex-meter
# 改 lib/index.js(宿主)/ lib/client.js(浏览器端 Usage 页面)
# 同步到已安装副本并重启桌面端验证

许可

MIT。价格引擎移植自 bpc-oss/dsh-web-billing(MIT), 宿主逻辑参考 dsh-deepseek-quota(MIT)。

—/ 5

No ratings yet

Verified DSH bundle

Commit dbe24eddf24d

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout