Preface

DSH’s extension philosophy is “Everything is a plugin”. The community directory is an independent site with no official affiliation with DeepSeek / Huanfang. For developers using the DSH Web UI, the provider typically returns token usage, but does not directly provide the current session and single-turn request’s USD cost. @steven-wu/dsh-cost-meter solves this mapping problem: it accumulates provider-reported usage based on a configurable price table and displays real-time cost badges in the Web UI session.

What is it

@steven-wu/dsh-cost-meter is a DSH plugin for displaying real-time USD cost badges in the currently open Web UI session. It calculates costs based on provider token usage and a configurable price table, supporting whole-session totals and per-turn costs. The plugin declares the dsh.bundle manifest and dsh.client package, with an MIT license.

Core Features

Cost Accumulation

The plugin registers a sessionCost projection on the session-projection seam. It tracks the current provider/model from request/header events and accumulates usage buckets reported by the provider: uncached input, output, cache-read, and cache-write.

It follows the rules of token-meter: it replaces samples for the same (turn, step) rather than counting them multiple times. The final output is whole-session totals and a byTurn map keyed by turn number.

UI Display

The plugin registers a badge in the conversation.chat.assistant-actions slot. This slot is located in the action row at the end of every assistant message. Each badge displays the cost for that turn; hovering opens a tooltip showing the breakdown by usage bucket and the session total.

Price Configuration

The price table uses USD per million tokens, with keys being provider/model. The plugin supports configuration through the following locations:

~/.dsh/cost-pricing.json
DSH_COST_PRICING
row's config.pricingPath

If a model does not have a models entry, it falls back to default; if default does not exist, the cost is calculated as 0.

Installation and Activation

Install to the web profile:

dsh plugin --profile web add @steven-wu/dsh-cost-meter

After installation, restart the web profile and refresh the page.

For development, use a local checkout:

dsh plugin --profile web add file:/path/to/dsh-cost-meter

The Plugins panel in Settings is read-only, used for inventory + config cards; installation is still done via dsh plugin --profile … add.

Additionally, purely-cordis mounting can also be completed by inserting a row via cordis.patch.yml; the plugin’s own cordis.patch.yml saves this row.

Typical Usage

  1. On the first run, the plugin reads ~/.dsh/cost-pricing.json during the boot phase and writes the default price table to that path.
  2. Edit that price table to maintain USD per million tokens prices by provider/model, then restart dsh web for the configuration to take effect.
  3. If you need to override the default path, you can use the environment variable:
DSH_COST_PRICING=/path/to/cost-pricing.json

You can also specify the path in the row’s config.pricingPath.

  1. Open a session in the Web UI, and a cost badge will appear at the end of the assistant message; hovering over the badge allows you to view that turn’s breakdown and the session total.

Applicable Scenarios and Notes

Suitable for people using DSH Web UI who want to convert provider token usage into USD costs. Typical requirements include: viewing cumulative costs for the current session, viewing costs for a single assistant turn, and customizing price tables by provider/model.

Please note before installation:

  • The plugin runs with the permissions of the current dsh process; check the source code, dependencies, and license before installing.
  • @deepseek-ai/dsh-* should be resolved from the harness as peerDependencies, not installed as dependencies into the profile; otherwise, it may shadow the harness copy and potentially pull a stale dist-tag.
  • The sessionCost projection is provided through the same seam as tokenUsage / sessionStats, appearing in projection carriers, such as the history tail page and session/projection push frames.
  • The community directory is an independent site with no official affiliation with DeepSeek / Huanfang.

Links

  • Directory Page: https://www.skillhub.cn/plugins/Sttrevens/dsh-cost-meter
  • GitHub: https://github.com/Sttrevens/dsh-cost-meter