Skip to content

940842546/dsh-usage-billing

30Last commit Aug 15, 2026

dsh-usage-billing DSH plugin

This plugin automatically monitors all DeepSeek model calls across sessions, calculates costs based on official pricing tiers, and provides dashboard panels on the main interface and settings page. It supports historical backfill, segmented billing by time zones, and persistent data storage.

How to install the dsh-usage-billing DSH plugin

dsh plugin --profile web add dsh-usage-billing

Copying does not run this command. Review the repository and version before installing the dsh-usage-billing DSH plugin.

dsh-usage-billing DSH plugin data source

dsh-usage-billing DSH plugin snapshot date: Aug 16, 2026

discovered

What the dsh-usage-billing DSH plugin can do

  • Automatically listens to `llm/stream` to record tokens for every model call (input, output, cache hit/miss).
  • Backfills historical usage and costs from session logs on first startup, including session titles.
  • Segments billing by Beijing time: pre-2026-08-17 old prices, post-8/17 peak (9–12, 14–18) and off-peak.
  • Displays a floating summary panel (total cost, segment ratios, heatmap, top 5 sessions) via a button in the main interface.
  • Shows a persistent usage bar for the current session below the input field.
  • Provides a full dashboard in Settings → Usage Statistics, with cards, segment breakdown, daily/weekly/monthly/yearly/cumulative heatmaps, top 8 sessions, model breakdown, recent calls, backfill/clear actions.
  • Exposes a dynamic tool `usage_stats` for the model to query statistics directly.
  • Persists data to `.dsh-usage-stats.json` in the write strategy root directory, surviving restarts.
  • Fully bilingual (Chinese/English), switching with the app language.

Where the dsh-usage-billing DSH plugin fits

  • Monitor DeepSeek API costs in real-time across all conversations.
  • Analyze usage patterns to optimize model selection and budget allocation.
  • Track historical token consumption and expenses for reporting or auditing.
  • Identify top sessions or models consuming the most resources.
  • Quickly ask the model 'How much have I spent?' using the `usage_stats` tool.

Who the dsh-usage-billing DSH plugin is for

  • Developers and power users of DeepSeek Harness who need to manage API costs.
  • Teams or individuals using DeepSeek models heavily and wanting to track billing per session or time period.

dsh-usage-billing DSH plugin limitations

  • Only supports DeepSeek models (v4-flash, v4-pro) with the official pricing table hardcoded; custom models or prices are not supported.
  • Billing logic is based on Beijing time (CST); users in other timezones may experience boundary discrepancies.
  • Data is shared across multiple instances; running two instances simultaneously may corrupt the stats file.
  • Requires DeepSeek Harness to be running with DeepSeek model configured; no standalone usage.
  • The plugin is still evolving (v0.2.0+); schema migration may occur on updates.

dsh-usage-billing DSH plugin: from the repository README

Quoted from the 940842546/dsh-usage-billing README, the upstream source of the dsh-usage-billing DSH plugin. Copyright remains with the original authors.

中文 | [English](README.en.md) 针对 DeepSeek Harness 的**免构建**双面插件:自动统计本机所有会话的 DeepSeek 模型调用,按官方定价分段计费,并在主界面与设置页提供图表化的用量面板。 > 计费口径:2026-08-17 00:00(北京时间)前旧价;之后峰谷定价(高峰 9:00–12:00、14:00–18:00,其余空闲时段)。价格表见文末。 ## 功能 - **全自动统计**:监听 `llm/stream`,所有会话的每次模型调用都会被记录(输入/输出/缓存命中/未命中 tokens) - **历史回填**:首次启动自动扫描本机会话日志,重建历史用量与消费,并附会话标题 - **分段计费**:按北京时间自动归入「8/17 前旧价 / 8/17 后高峰 / 8/17 后空闲」三段 - **主界面**: - 左下角「用量」按钮 → 悬浮汇总面板(总费用、分段占比、用量热力图、会话 Top 5) - 输入框下方常驻一行**当前会话**的用量 - **设置页 → 用量统计**:完整明细(统计卡片、分段占比、日/周/月/年/累计热力图(悬停即时显示 token 与金额)、按会话 Top 8、按模型、最近调用、回填/清空) - **动态工具 `usage_stats`**:模型可直接查询统计(“现在用了多少钱?”) - **持久化**:数据写入写策略根目录 `.dsh-usage-stats.json`,重启不丢 - **中英双语**:所有界面文案跟随应用语言设置即时切换(中文 / English) ## 安装 ### 方式 A:npm 一键安装(推荐,预构建) ```powershell dsh plugin --profile web add dsh-usage-billing ``` npm 包:https://www.npmjs.com/package/dsh-usage-billing 应用启动时通过本包的 `dsh.bundle.patch`(`cordis.patch.yml`)自动挂载,无需任何其他配置。 > ⚠ 不要直接修改官方 bundle(如 `@deepseek-ai/dsh-web-app/cordis.patch.yml`), > 也不要把插件放进 `npm-cache\_npx` 缓存(npm reify 会随时重建并留下悬空链接)。 > 本地路径形式同样支持:`dsh plugin --profile web add <本仓库路径>`。 ### 方式 B:用户级补丁(不动 profile) 把本仓库根目录的 `cordis.patch.yml` 内容加入: ``` %USERPROFILE%\.dsh\cordis.patch.yml ```

Read the full READMERepository license: MIT

dsh-usage-billing DSH plugin questions

Why is the usage panel not showing up after installation?

The client bundle is discovered by the deployed `clientModules` service. You need to restart the DeepSeek Harness application and refresh the page after installing the plugin. If it still doesn't appear, ensure the plugin was installed correctly via `dsh plugin --profile web add dsh-usage-billing` and that the profile is active.

How do I fix duplicate statistics after upgrading?

Older versions may have backfilled without clearing first. Starting from v0.2.0, the plugin uses a `schemaVersion` migration marker. Restart the application; it will automatically rebuild the stats once to correct duplicates. If the issue persists, manually clear the stats file (`.dsh-usage-stats.json`) and restart.

Can I use this plugin with multiple DeepSeek Harness instances?

No, the stats file is a shared resource. Running two instances simultaneously will overwrite each other's data and cause corruption. Keep only one instance running at a time.

Does the plugin support custom pricing or models other than DeepSeek?

No, the pricing table is hardcoded for DeepSeek v4-flash and v4-pro models. Custom models or custom prices are not supported. If you need custom pricing, you would need to modify the plugin source code.

How do I change the language of the interface?

The plugin automatically follows the language setting of DeepSeek Harness. Change the application language to Chinese or English, and the plugin's UI (including the floating panel and settings page) will switch immediately.