TwotwoPiggy/dsh-balance1

dsh-balance

DeepSeek 余额实时显示插件: 在 dsh Web UI 输入框下方的统计条(命中率/输入输出 token 行)实时显示账户余额与本次对话的估算消耗

AI 分析

核心用途是在输入框下方直观展示当前 API 账户余额和本次对话的花费。适合使用 DeepSeek 官方 API、需要时刻掌控资费消耗的用户。

パッケージ
dsh-balance
バージョン
0.1.6
最終更新
2026/08/13

インストール

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:TwotwoPiggy/dsh-balance

ドキュメント

README 全文を読む ↗

方式一:使用 DSH CLI 自动安装与配置(推荐)

DeepSeek Harness 自带的插件管理命令可以为您一键完成下载安装和修改配置文件

dsh plugin --profile web add dsh-balance

执行完毕后,重启 dsh web 即可生效。

配置

$DSH_HOME/profiles/web/cordis.patch.yml 中覆盖(整行替换, 需重述所有键):

- id: query-balance
  config:
    apiKey: ''                    # 显式密钥; 留空走 credentials(DEEPSEEK_API_KEY)
    apiKeyRef: DEEPSEEK_API_KEY   # credentials / 环境变量引用名
    baseUrl: https://api.deepseek.com
    refreshIntervalMs: 300000     # 查询频率: 服务器向 DeepSeek 拉取余额的间隔(毫秒)
    clientPollIntervalMs: 30000   # 浏览器刷新显示的间隔(毫秒)
    timeoutMs: 8000               # 单次请求超时
    currency: CNY                 # 花费估算计价货币(与 prices 一致)
    prices:                       # 每 1M token 单价(按 currency 计价)
      deepseek-chat: { cacheHit: 0.2, cacheMiss: 2, output: 8 }
      deepseek-reasoner: { cacheHit: 0.5, cacheMiss: 4, output: 16 }
    defaultPrices: { cacheHit: 0.2, cacheMiss: 2, output: 8 }  # 未列出模型的回退价

价格为公开参考价, 若官方调整请自行更新; 若余额为 USD, 请把 currencyprices 一并改为美元价。