dsh-conversation-cost
Agent 与会话 活跃维护

dsh-conversation-cost

WinnieJQ/dsh-conversation-cost

零依赖实现单次会话的DeepSeek API成本核算,支持峰谷差异化定价规则,可在Web对话界面展示实时悬浮成本徽章,自动输出会话成本预估结果。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
10 KB
仓库大小
3 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:WinnieJQ/dsh-conversation-cost
git clone https://github.com/WinnieJQ/dsh-conversation-cost.git
git clone git@github.com:WinnieJQ/dsh-conversation-cost.git
README.md main

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