Bundle
dsh-conversation-cost
Per-conversation DeepSeek API cost badge for DeepSeek Harness: a zero-dependency session projection pricing each LLM step against the official rate card, with a live cost badge and hover card in the web conversation header.
- Source
- WinnieJQ
- License
- MIT
- Updated
- Updated 2 days ago
Readme
# dsh-conversation-cost
[English](#english) | 中文
DeepSeek Harness 的**按对话计费插件**:在 Web 界面会话标题右侧显示当前对话的累计 API 费用徽章,悬停查看完整明细——不需要再去 DeepSeek 平台查账单。
## 特性
- **零依赖、零构建**:宿主半部是纯 ESM,浏览器半部是手写的模块系统工厂形态,无需打包器
- **精确计价**:按步骤折叠 provider 用量(输入 / 缓存命中 / 输出 tokens),关联每步实际运行的模型,区分**峰谷时段**分别计价
- **实时更新**:基于 `sessionCost` 会话投影,每一步完成时徽章自动刷新
- **多模型支持**:v4-pro / v4-flash / v4-flash-vision-exp / legacy V3,单价表可配置
- **双币显示**:徽章与明细同时显示 ¥ 与 $(汇率可配置)
## 安装
```sh
dsh plugin --profile web add dsh-conversation-cost
```
重启 `dsh web` 后生效。
## 配置
在 `~/.dsh/profiles/<name>/cordis.patch.yml`(用户覆盖层)中按行 id 覆盖:
```yaml
- 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 官方定价页](https://api-docs.deepseek.com/quick_start/pricing),调价时按上面格式更新即可。
## 说明
- 徽章数字是按官方 USD 单价 × 配置汇率计算的**估算值**,与平台账单的 RMB 换算可能有细微出入(平台使用自己的内部汇率)
- 只显示**当前对话**的累计费用
- 卸载:`dsh plugin --profile web remove dsh-conversation-cost`
## License
[MIT](LICENSE)
---
<a name="english"></a>
## 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
Install
dsh plugin --profile web add github:WinnieJQ/dsh-conversation-cost
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-conversation-cost from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.