Introduction

When using DeepSeek within DSH, you need to constantly verify how much the current session has cost, but you don’t want to manually look up prices or multiply by unit prices, nor do you want the cost display plugin to make extra external requests.

dsh-cost is a native DSH plugin: it calculates the current conversation cost in real-time based on DeepSeek’s peak and valley pricing tables and displays a cost badge next to the input box.

What is it

dsh-cost is maintained by kami-mura for DSH web sessions. Based on token usage reported by the built-in DSH deepseek-official provider, it converts the current conversation cost into CNY or USD and permanently displays it next to the input box.

The license is MIT.

Key Features

  • A permanent cost badge next to the input box, automatically updating when token usage changes.
  • Currency can be selected as CNY or USD in DSH Settings > Plugins > Plugin configuration, default is CNY, and the selection is saved in the current browser.
  • The tooltip language follows the DSH system language: Chinese / English.
  • Hover over the cost icon to view input tokens, output tokens, flash costs, and pro costs.
  • Costs are rounded to two decimal places; if less than 0.01, it is displayed as <0.01.
  • Pricing is based on DeepSeek’s official RMB and USD price tables, and peak/valley periods in Beijing time.
  • Separately calculates cache hits, cache misses, cache writes, and output.
  • Usage for the same turn/step is deduplicated according to projection replacement rules.
  • Unrecognized third-party models do not have estimated prices and display ≈/¥0+ or ≈/$0+.
  • Host-side calculation via durable session projection costLog; paging, context compression, and history pull do not change the cumulative value.
  • Browser-side read-only projection and rendering, without making external requests.
  • Styles use DSH WebUI design tokens and automatically follow light/dark themes.

Installation and Usage

First, add the plugin:

dsh plugin --profile web add github:kami-mura/dsh-cost

After installation, you need to restart the dsh web service for it to take effect.

To uninstall, use:

dsh plugin --profile web remove dsh-cost-log

Typical Usage

  1. Open any session, and a cost badge will appear on the right side of the input box.
  2. Hover over the cost badge to view input tokens, output tokens, flash costs, and pro costs.
  3. Click the cost badge to view detailed costs for flash / pro.
  4. Switch currency: Open DSH Settings > Plugins > Plugin configuration and select CNY or USD.
  5. If you need to run tests:
node --test tests/*.test.mjs

Pricing Basis and Limitations

  • Only prices deepseek-v4-flash and deepseek-v4-pro for the built-in DSH deepseek-official provider.
  • Unrecognized third-party models do not have estimated prices and display ≈/¥0+ or ≈/$0+.
  • Separately calculates cache hits, cache misses, cache writes, and output.
  • Usage for the same turn/step is deduplicated according to projection replacement rules to avoid double-counting the same usage.
  • The amount is a reference estimate based on token usage reported by the provider, not DeepSeek’s official bill.

Architecture and Privacy

  • Host-side calculation via durable session projection costLog; paging, context compression, and history pull do not change the cumulative value.
  • Browser-side read-only projection and rendering, without making external requests.
  • Does not read API keys, query account balances, or send external requests.
  • Does not require a database, proxy, or additional background services.
  • Relies on DSH runtime capabilities: Host sessionProjections; Client slots, locale, react platform modules, and the ui-conversation conversation.input.right slot.

Use Cases and Notes

Suitable for those who need to continuously check DeepSeek conversation costs in DSH web sessions, especially when using deepseek-v4-flash and deepseek-v4-pro.

Before installation, check the source code and the MIT license. The plugin runs with the permissions of the current dsh process; it is recommended to only install versions from trusted sources.

From 1.0.0, it has entered stable maintenance: no new features will be added, and updates will only occur when DeepSeek’s official prices or DSH interfaces change.

Links

GitHub Repository: https://github.com/kami-mura/dsh-cost