wwwwangpengggg/dsh-api-balance0

dsh-api-balance

在桌面常驻小窗显示API余额与消费情况

AI 分析

适合Windows桌面版用户,便于实时监控DeepSeek API余额和Token消耗。

包名
dsh-api-balance
版本
0.2.2
许可证
MIT
最近更新
2026年9月12日

安装

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

2) 装进桌面版使用的 profile

dsh plugin --profile desktop add git+https://github.com/wwwwangpengggg/dsh-api-balance.git

配置 API Key

小窗要读你的 DeepSeek API Key。它会按这个顺序找:

  1. 环境变量 DEEPSEEK_API_KEY
  2. $DSH_HOME/.credentials.yaml 里的同名键(DSH 自己的凭据文件,通常已经配好了)

Key 不会经过 DSH 的 IPC,也不会出现在任何命令行里 —— 小窗进程自己去读, tests/config.test.mjs 有一条断言专门防这件事。

没配好时小窗会显示「未配置密钥」,配上后点「刷新」即可,不用重启。

配置

cordis.patch.yml(插件自带的那份是默认值),或在 $DSH_HOME/profiles/ /cordis.patch.yml 里按 id 覆盖:

- id: api-balance
  config:
    enabled: true
    refreshSeconds: 60      # 10 - 3600,超出会被夹紧
    dayStartHour: 8         # 「今日消费」的一天从几点开始(0-23,默认 8;填 0 即自然日)
    corner: top-right       # top-right / top-left / bottom-right / bottom-left
    currency: ''            # 留空 = 用接口返回的第一种;可写 CNY / USD
    baseUrl: https://api.deepseek.com
    credentialEnv: DEEPSEEK_API_KEY
    credentialFile: ''      # 留空 = $DSH_HOME/.credentials.yaml
    stateDir: ''            # 留空 = $DSH_HOME/plugins/dsh-api-balance
    instanceName: DshApiBalanceWindow