huolianJiao/dsh-quota-meter1

dsh-quota-meter

DSH 网页插件:显示 DeepSeek API 余额,估算各模型可用 Token,并图表化单轮对话的实际成本。

AI 分析

核心用途是监控 DeepSeek API 的用量与花费。适合需要精细化控制 API 预算、评估缓存命中率及高峰计价影响的 DSH 网页端用户。

套件
dsh-quota-meter
版本
0.1.0
授權
MIT
最近更新
2026年8月14日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:huolianJiao/dsh-quota-meter

配置 API Key

插件默认读取凭据引用 DEEPSEEK_API_KEY(可在设置页切换)。任选其一:

  • 环境变量:DEEPSEEK_API_KEY=sk-...
  • 或写入 DSH 凭据文件 $DSH_HOME/.credentials.yaml
DEEPSEEK_API_KEY: sk-...

配置

  • 设置页(推荐):Settings → 「DS API 计费 / DS API Billing」,可视化编辑计价表、高峰时段、回退占比等,保存立即生效。
  • 补丁文件(固化默认值):在 profile 的 cordis.patch.yml 按 id 覆盖,重启生效:
- id: dsh-quota-meter
  config:
    apiKeyEnv: DEEPSEEK_API_KEY
    baseURL: https://api.deepseek.com
    pollIntervalMs: 60000
    summaryModel: deepseek-v4-pro
    peakWindows:
      - { start: "09:00", end: "12:00" }   # 北京时间,[start, end)
      - { start: "14:00", end: "18:00" }
    pricing:                                # 元 / 百万 token
      - model: deepseek-v4-flash
        offPeak: { input: 1.5, cacheHit: 0.05, output: 4.5 }
        peak:    { input: 3.0, cacheHit: 0.10, output: 9.0 }
      - model: deepseek-v4-pro
        offPeak: { input: 4.5, cacheHit: 0.15, output: 13.5 }
        peak:    { input: 9.0, cacheHit: 0.30, output: 27.0 }