bowenliang123/dsh-context
bowenliang123/dsh-contextDSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
输入框右侧会话成本芯片:按官方价表(含 2026-08-17 峰谷价)逐消息计价当前会话的 DeepSeek API 花费,悬停查看计价明细、今日(DSH) 消耗与账户余额;仅 DeepSeek 模型计价,其他模型不计价不显示。
English | 中文
A DeepSeek Harness (dsh) web plugin that shows the current session's DeepSeek API cost as a small chip beside the composer input.
conversation.input.right slot (left of the model selector) shows the current session's DeepSeek API spend (¥), refreshed every 5 seconds.DEEPSEEK_API_KEY via the official user/balance endpoint.assistant/message event is priced by its own timestamp against the official DeepSeek pricing timeline, including the 2026-08-17 peak/off-peak policy (Beijing 09:00–12:00 / 14:00–18:00 peak, half price otherwise), and covering history from before this plugin was installed.dsh plugin --profile web add @phynez_1103/dsh-session-cost
⚠️ Note: this plugin's npm package name is scoped:
@phynez_1103/dsh-session-cost. The unscopeddsh-session-costpackage on npm (ChengChe106/dsh-session-cost) is a different, same-named plugin, unrelated to this repo —dsh plugin add dsh-session-costinstalls that one, not this one.
Or install straight from the GitHub repo:
dsh plugin --profile web add github:Lzh3070/dsh-session-cost
Or from the Gitee mirror (faster in mainland China):
dsh plugin --profile web add https://gitee.com/lzh10602042_gitee/dsh-session-cost/repository/archive/master.zip
Restart the dsh web service and hard-refresh the browser (Ctrl+Shift+R).
First use: configure DEEPSEEK_API_KEY in Settings → Models (used for the balance and today's total; without it the balance shows --, session cost still works).
The chip (¥0.12) beside the composer input, with the hover popover:
Popover contents example:
当前会话花费 ¥6.55
项目 数量 单价 金额
输入(未命中) 3.5M ¥1.000/M ¥3.49
缓存命中 111.8M ¥0.020/M ¥2.24
输出 410.5K ¥2.00/M ¥0.821
──────────────────────────────
今日(DSH) ¥0.356
账户余额 ¥197.66
Built-in official DeepSeek policy timeline (CNY per 1M tokens):
| Model | Stage | Input (miss) | Cache hit | Output |
|---|---|---|---|---|
| deepseek-v4-flash | current (since 2026-05-22) | 1 | 0.02 | 2 |
| deepseek-v4-flash | peak (since 2026-08-17) | 3 | 0.1 | 9 |
| deepseek-v4-flash | off-peak (since 2026-08-17) | 1.5 | 0.05 | 4.5 |
| deepseek-v4-pro | current (since 2026-05-22) | 3 | 0.025 | 6 |
| deepseek-v4-pro | peak (since 2026-08-17) | 9 | 0.3 | 27 |
| deepseek-v4-pro | off-peak (since 2026-08-17) | 4.5 | 0.15 | 13.5 |
The table lives in OFFICIAL_PRICING_POLICIES in lib/index.js; append entries to the since timeline when the official pricing changes.
cordis.patch.yml inserts the plugin row into the host composition
dsh.plugin.json plugin metadata (entry id + client platform)
lib/index.js host entry: SessionCostRuntime (TypertRemoteService) +
official pricing engine + strict Typert manifest
lib/client.js single-file client bundle (ModuleLoader handshake):
composer cost chip + hover popover (class component)
lib/invariant.js invariants companion entry
sessionCost(sessionId): replays the persisted session log via sessionPersistence.readRaw, prices every message, cached by log revision.accountSummary(): replays all sessions for today's (Beijing) DeepSeek usage; reads DEEPSEEK_API_KEY from DSH credentials for the official user/balance call.conversation.input.right slot, 5s session poll + 60s account cadence + hover popover.MIT. The pricing engine is ported from dsh-deepseek-quota (MIT, itself ported from bpc-oss/dsh-web-billing, MIT).