
ChengChe106/dsh-session-cost
30Last commit Aug 14, 2026
dsh-session-cost DSH plugin
This plugin adds a real-time cost estimate line below the token usage statistics in the DSH Web GUI. It reads token usage data from the official `dsh-token-meter` projection and calculates the session cost using DeepSeek's published pricing, including cache hit/miss and output token costs. The display automatically adapts to theme and uses the same font style as the built-in statistics bar.
How to install the dsh-session-cost DSH plugin
dsh plugin add dsh-session-costCopying does not run this command. Review the repository and version before installing the dsh-session-cost DSH plugin.
dsh-session-cost DSH plugin data source
dsh-session-cost DSH plugin snapshot date: Aug 16, 2026
discovered
What the dsh-session-cost DSH plugin can do
- Shows session cost estimate with hit/miss/output breakdown in the GUI status bar
- Supports DeepSeek-V4-Flash and DeepSeek-V4-Pro models with peak/off-peak pricing
- Automatically switches between peak and off-peak pricing based on Beijing time (peak hours: 9-12, 14-18)
- Uses the same token usage data source as the official statistics bar for consistency
- Theme-responsive font and color matching the native DSH Web GUI
Where the dsh-session-cost DSH plugin fits
- Monitor real-time API spending during a conversation session
- Compare cost differences between cached and uncached inputs
- Estimate the impact of model choice (Flash vs Pro) on session cost
- Track costs when using DSH as a frontend for DeepSeek API
- Help developers budget for API usage during testing or production
Who the dsh-session-cost DSH plugin is for
- DSH users who want to track their DeepSeek API expenses
- Developers using DeepSeek API through DSH and need cost visibility
dsh-session-cost DSH plugin limitations
- Cost is an estimate only and may differ from actual billing due to rounding, model switches, and the assumption that cache write tokens are counted as miss tokens
- Only supports DeepSeek-V4 models by default; to add other models, you must manually edit the pricing table in `lib/client.js`
- Model changes mid-session are not retroactively reapplied to earlier tokens
- Requires the `dsh-token-meter` plugin to be active (bundled with DSH Web)
dsh-session-cost DSH plugin: from the repository README
Quoted from the ChengChe106/dsh-session-cost README, the upstream source of the dsh-session-cost DSH plugin. Copyright remains with the original authors.
DSH(DeepSeek Harness)插件:在 Web GUI 底部统计条里显示**当前会话的 DeepSeek API 费用估算**。 效果:统计条下方多出一行 `费用 ≈¥0.35 | 命中 ¥0.28 | 未命中 ¥0.02 | 输出 ¥0.05`,字体与配色完全对齐官方统计条(12px、主题自适应)。  ## 安装 ```bash dsh plugin add dsh-session-cost ``` (`dsh` 未全局安装时:`npx --yes @deepseek-ai/dsh plugin --profile web add dsh-session-cost`) 安装后**重启 `dsh web` 生效**。 ## 怎么算的 - 数据源:DSH 的 `tokenUsage` 会话投影(官方 `dsh-token-meter` 提供,与统计条同源):`uncachedInputTokens` / `cacheReadTokens` / `cacheWriteTokens` / `outputTokens` - 计费口径(对应官方账单):缓存**写入**按"未命中"单价计 `费用 = (未命中 + 写入) × miss单价 + 命中 × hit单价 + 输出 × out单价` - 价格:官方 https://api-docs.deepseek.com/zh-cn/quick_start/pricing | 模型 | 百万输入(命中) | 百万输入(未命中) | 百万输出 | | --- | --- | --- | --- | | deepseek-v4-flash(2026-08-17 前) | ¥0.02 | ¥1 | ¥2 | | deepseek-v4-pro(2026-08-17 前) | ¥0.025 | ¥3 | ¥6 | | deepseek-v4-flash · 高峰(9-12/14-18 北京时间) | ¥0.10 | ¥3 | ¥9 | | deepseek-v4-flash · 空闲 | ¥0.05 | ¥1.5 | ¥4.5 | | deepseek-v4-pro · 高峰 | ¥0.30 | ¥9 | ¥27 | | deepseek-v4-pro · 空闲 | ¥0.15 | ¥4.5 | ¥13.5 | - 2026-08-17 00:00(北京时间)起自动切换峰谷计价;高峰时段自动按北京时间判断 ## 说明与限制 - **估算值**:仅供参考,与实际账单可能有出入(缓存写入归入未命中的口径、模型切换、四舍五入) - **模型**:v1 按 `deepseek-v4-flash` 计(会话中途切换模型不追溯);要改默认模型/价格,
Read the full READMERepository license: MIT
dsh-session-cost DSH plugin questions
How do I install the dsh-session-cost plugin?
Run `dsh plugin add dsh-session-cost` in your terminal. If `dsh` is not globally installed, use `npx --yes @deepseek-ai/dsh plugin --profile web add dsh-session-cost`. After installation, restart `dsh web` to see the cost display.
Why is the cost shown with a '≈' symbol?
The cost is an estimate. It may not match your actual bill exactly due to factors like rounding, model switches during a session, and the assumption that cache write tokens are counted as 'miss' tokens. The '≈' indicates it's an approximation.
Can I use this plugin with models other than DeepSeek-V4?
By default, the plugin only supports DeepSeek-V4-Flash and DeepSeek-V4-Pro. To add other models, you need to manually edit the pricing table in `lib/client.js` in the plugin's source code. After editing, restart DSH Web.
How does the peak/off-peak pricing work?
The plugin automatically switches pricing based on Beijing time. Peak hours are 9:00-12:00 and 14:00-18:00 (Beijing time). During peak hours, higher rates apply; during off-peak hours, lower rates are used. The transition happens automatically at the system time.
Does the plugin require any other dependencies?
It depends on the `dsh-token-meter` plugin, which is built into DSH Web and provides the token usage data. No separate installation is needed. The plugin itself is lightweight and only adds a cost line to the existing UI.