Daviszhou212/dsh-cost-pill0

dsh-cost-pill

DSH Web plugin: a session API-cost + account-balance pill merged into the official composer stats row, with a click-open breakdown panel. Host half registers a `costPill` session projection and a loopback-only balance route; browser half renders it through the slot runtime.

包名
dsh-cost-pill
版本
0.1.0
许可证
MIT
最近更新
2026年9月10日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Daviszhou212/dsh-cost-pill

配置(可选)

在 profile 的 cordis.patch.yml 里用 id 定向覆盖价格表:

- id: cost-pill
  config:
    pricing:
      deepseek-flash:                      # 键 = 模型 id(大小写不敏感,支持最长前缀匹配)
        offpeak: { input: 1, cacheRead: 0.02, cacheWrite: 1, output: 4 }
        peak: { input: 2, cacheRead: 0.04, cacheWrite: 2, output: 8 }
      acme/mystery-1:                      # 也可写完整 provider/model:同一模型分渠道定价
        input: 3                           # 不分时段写法:各时段同价
        output: 6

选价顺序:完整 provider/model 精确匹配 → 模型 id 精确匹配 → 两者各自的最长前缀匹配。 所以 deepseek-flash 能同时命中 deepseek-official/deepseek-flash,而 deepseek-v4-flash:0731 这类带变体后缀的 id 会落到 deepseek-v4-flash

单位固定为元 / 百万 tokencacheWrite 官方无独立价,按未命中输入价计。

在线刷新的配置(pricingRefresh 段,整段可省):

- id: cost-pill
  config:
    pricingRefresh:
      enabled: true          # false = 只用内置价目,完全不联网
      ttlMs: 86400000        # 缓存存活时间(默认 24 小时);TTL 内不重新抓取
      timeoutMs: 15000       # 单次抓取超时
      url: 'https://api-docs.deepseek.com/zh-cn/quick_start/pricing/'   # 必须 https
      cachePath: ''          # 默认 $DSH_HOME/storages/dsh-cost-pill-pricing.json