Back to home@WinnieJQ

dsh-conversation-cost

Per-conversation DeepSeek API cost badge for DeepSeek Harness (dsh): zero-dependency sessionCost projection with peak/off-peak pricing and a live hover-card badge in the web conversation header.

Stars
0
Language
JavaScript
Created
Aug 28, 2026
Updated
Aug 28, 2026
GitHub repo

Introduction

dsh-conversation-cost

English | 中文

DeepSeek Harness 的按对话计费插件:在 Web 界面会话标题右侧显示当前对话的累计 API 费用徽章,悬停查看完整明细——不需要再去 DeepSeek 平台查账单。

特性

  • 零依赖、零构建:宿主半部是纯 ESM,浏览器半部是手写的模块系统工厂形态,无需打包器
  • 精确计价:按步骤折叠 provider 用量(输入 / 缓存命中 / 输出 tokens),关联每步实际运行的模型,区分峰谷时段分别计价
  • 实时更新:基于 sessionCost 会话投影,每一步完成时徽章自动刷新
  • 多模型支持:v4-pro / v4-flash / v4-flash-vision-exp / legacy V3,单价表可配置
  • 双币显示:徽章与明细同时显示 ¥ 与 $(汇率可配置)

安装

dsh plugin --profile web add dsh-conversation-cost

重启 dsh web 后生效。

配置

~/.dsh/profiles/<name>/cordis.patch.yml(用户覆盖层)中按行 id 覆盖:

- id: cost-meter
  config:
    currency: CNY            # 徽章显示币种:CNY 或 USD
    cnyRate: 7.25            # USD→CNY 汇率
    offPeakFactor: 0.5       # 谷时价格系数
    peakWindowsUtc:          # 峰时窗口(UTC 小时,周一至周五)
      - [1, 4]
      - [6, 10]
    defaultModel: deepseek-v4-pro
    models:                  # USD / 1M tokens(峰时价)
      deepseek-v4-pro:
        input: 1.32
        cacheRead: 0.044
        output: 3.96
      deepseek-v4-flash:
        input: 0.44
        cacheRead: 0.014
        output: 1.32

单价取自 DeepSeek 官方定价页,调价时按上面格式更新即可。

说明

  • 徽章数字是按官方 USD 单价 × 配置汇率计算的估算值,与平台账单的 RMB 换算可能有细微出入(平台使用自己的内部汇率)
  • 只显示当前对话的累计费用
  • 卸载:dsh plugin --profile web remove dsh-conversation-cost

License

MIT


English

A per-conversation cost meter for DeepSeek Harness: a badge in the web conversation header showing the session's cumulative API spend, with a hover card breaking down tokens and per-model cost.

  • Zero dependencies, no build step
  • Prices each LLM step against the official per-model rate card, split by peak/off-peak windows
  • Live-updating sessionCost session projection
  • Install: dsh plugin --profile web add dsh-conversation-cost
  • Pricing is an estimate (official USD rates × configurable FX); see configuration above