Preface

When calling DeepSeek within DSH, a common requirement is to check the cumulative tokens used in the current session and roughly estimate the corresponding cost. dsh-token-cost-meter is a DSH plugin that displays the cumulative token consumption and estimated cost (in RMB) of the current session in real-time below the input box in the Web GUI, with prices dynamically fetched from the DeepSeek official pricing page.

Below, I will first explain what it does, followed by the installation and activation steps.

What is it

The repository name is dsh-token-cost-meter, the owner is YZz-S, and the license is MIT.

It supports two usage forms:

  • Installable dsh.bundle package;
  • Dynamic cordis_define usage.

The installable version is suitable for long-term activation; the dynamic usage is suitable for temporary execution within the current DSH process.

Core Features

  • Display the cumulative token consumption and estimated cost of the current session below the input box in the DSH Web GUI.
  • Read the session projection tokenUsage, including cache misses, cache hits, and outputs.
  • The Host side fetches and parses the DeepSeek official pricing page every 6 hours, including peak and valley price tables, and automatically switches time periods based on Beijing time.
  • When the official pricing page fetch fails, it falls back to a built-in price snapshot; an is added before the amount, and the reason is noted in the tooltip.
  • Model identification uses a three-level fallback: the most recent request’s provenance, requestConfig, or the Host’s agents.options.model.
  • Hovering displays details such as the pricing model, input buckets, outputs, pricing mode, price source, and fetch time.

Cost Calculation

The price unit is CNY / million tokens.

The billing formula is:

Cost (CNY) = cache-miss input × miss price + cache-hit input × hit price + output × output price

Here, input and output come from the session projection tokenUsage, and prices come from the DeepSeek official pricing page. Starting from 2026-08-17, the plugin will automatically switch prices according to the official peak and valley time tables.

Installation and Activation

Installing dsh.bundle

Prerequisites:

  • DSH Web mode;
  • The installable Host process requires Node ≥ 18 with native fetch;
  • The verification environment was DSH 0.1.0-rc.6 + Node.js v22 + Windows.

Execute the installation command:

dsh plugin --profile web add github:YZz-S/dsh-token-cost-meter

After installation, restart DSH, and the cost statistics line below the input box will take effect automatically.

Dynamic cordis_define

Dynamic plugins are session-level; they need to be redefined and run after the DSH process restarts. Steps are as follows:

  1. Open DSH Web and enter a session.
  2. Call cordis_define in the session, submit the full text of host.js as code.host, and submit the full text of client.js as code.client.
  3. Execute run on the pluginId / packageId returned by cordis_run.
  4. Refresh the page after approving the Run card.

After the above steps, a cost statistics line will appear below the input box.

Note: In the dynamic form, the price fetch command in host.js uses PowerShell syntax, which is available by default on Windows; Linux/macOS requires replacing NODE_FETCH with the corresponding shell syntax.

Typical Usage

After enabling, a reading similar to the following will appear below the input box:

费用 ¥0.13 · 43.2K tokens

You can also see the English format:

Cost ¥0.13 · 43.2K tokens

The hover tooltip will show details, including the pricing model, input buckets, outputs, pricing mode, price source, and fetch time.

Applicable Scenarios and Notes

Suitable for developers who need to view DeepSeek’s current session token consumption and estimated cost in a DSH Web session. This plugin runs with the permissions of the current DSH process; it is recommended to check the repository source code and LICENSE before installing.

Please note:

  • The cost is an estimate, not an official bill; the actual charges are subject to the DeepSeek platform.
  • The built-in price snapshot was fetched on 2026-08-15 and may lag behind official price changes; it is only used for fallback when dynamic fetching fails.
  • Dynamic plugins are session-level; after restarting the DSH process, they need to be redefined and run, or the installable method should be used instead.
  • The dynamic form host.js is suitable for Windows by default; Linux/macOS requires replacing NODE_FETCH.
  • Platform requirements: DSH Web mode and support for dynamic Cordis plugins; verified on DSH 0.1.0-rc.6 + Node.js v22 + Windows.
  • The only outbound request is to the DeepSeek official public pricing page; token usage is displayed locally only and is not uploaded or persisted to disk.

Links

  • GitHub: https://github.com/YZz-S/dsh-token-cost-meter
  • The directory page URL was not provided in the captured data and cannot be confirmed.