philmingdao / dsh-meter

Listed

DSH plugin (#dsh-plugin): DeepSeek usage & balance meter for the DSH settings panel — account balance, today's spend (official stats or balance-based estimate), API Key & platform Token management.

mainOther View source

Installation

npx -y @deepseek-ai/dsh plugin --profile web add github:philmingdao/dsh-meter

This installation command is an unverified starting point generated from the GitHub repository address.

README

Maintainer-authored documentation snapshot.

View on GitHub ↗
Commit fdfda3dSynced Aug 18, 2026

This README snapshot could not be refreshed during the latest directory sync.

dsh-meter

DeepSeek 用量与余额计量插件 — 在 DSH(DeepSeek Harness)桌面端的设置菜单中展示 DeepSeek 开放平台的账户余额与使用量,并支持配置 API Key 与平台 Token。

DSH 插件(#dsh-plugin),基于 DSH 动态 Cordis 插件机制(cordis_define + cordis_run)开发,分为 Host / Client 两个半区。

功能

  • 账户余额:调用 https://api.deepseek.com/user/balance,展示充值余额、赠送余额与可用状态(多币种账户自动汇总)。
  • 今日用量:配置平台 Token 后展示官方统计(今日 / 本月消费);未配置 Token 时自动降级为余额变化估算
  • 凭据管理:页面内直接保存 / 清除 API Key 与平台 Token(存储于 DSH 凭据服务)。
  • 自动刷新:每 5 分钟自动刷新,设置菜单项实时显示余额摘要(如 DeepSeek 用量 · ¥12.34)。

工作原理

半区文件职责
Hosthost.js解析凭据(credentials)、通过 shell 服务 curl 调用 DeepSeek 接口、注册 5 个 RPC handler(dsusage.overview / setKey / clearKey / setToken / clearToken
Clientclient.js通过 slots 注册设置页 settings.sectiondeepseek-usage),渲染余额卡片与用量卡片,定时刷新
Client (React UI)  <--host.call-->  Host (RPC handlers)  --curl-->  DeepSeek API / Platform

配置

密钥优先级:DEEPSEEK_USAGE_KEY(自定义) → DEEPSEEK_API_KEY(DSH 已配置)。

变量必填说明
DEEPSEEK_API_KEY余额必需DSH 环境中已有的 Key,用于余额接口
DEEPSEEK_USAGE_KEY可选自定义 Key,优先级更高,覆盖 DSH 配置
DEEPSEEK_PLATFORM_TOKEN官方用量可选platform.deepseek.comuserToken,用于官方用量统计

获取平台 Token:浏览器登录 platform.deepseek.com → 开发者工具 → Application → Local Storage → https://platform.deepseek.com → 复制 userToken 的值。

安装 / 运行

方式 A:动态插件(会话级)

在 DSH Desktop 会话中说:

读取本仓库的 host.jsclient.js,用 cordis_define + cordis_run 重建 DeepSeek 用量与余额插件(插件名 dsqu-1,idPrefix dsqu)。

方式 B:持久化插件

将本插件注册到 desktop profile(cordis.patch.yml),每次启动 DSH Desktop 自动加载。

文件

dsh-meter/
├── host.js      # Host 半区:凭据解析、curl 请求、RPC handlers
├── client.js    # Client 半区:设置菜单页面 UI、自动刷新
└── define.json  # 完整的 cordis_define 定义(可直接重新提交)

许可证

MIT

Repository information

Language
JavaScript
License
MIT
Last updated
Aug 18, 2026, 8:23 AM

Install deliberately

Review source code, permissions, lifecycle hooks, dependencies and network access. Test untrusted plugins in an isolated environment.