Introduction

In the DeepSeek Harness (DSH) web chat interface, while requests have already incurred token usage, the spending amount and account balance are not always directly visible. For peers developing agents on DSH, the dsh-token-price plugin primarily addresses this issue: it displays the cost of each response turn, the total session cost, and the account balance within the Web UI.

DSH’s philosophy is “everything is a plugin.” The plugin directory page here is an independent site, not the official app store.

Plugin Positioning

dsh-token-price is a DSH client plugin, maintained by spoon-man569, licensed under MIT. It provides accurate Token cost and account balance display for the DeepSeek Harness Web chat interface.

Core Features

  • Display the token cost of each assistant response turn, denominated in ¥, visible on hover of the statistics row.
  • Display the total session cost, including request steps that have been cancelled but generated usage.
  • Display the estimated amount in Renminbi (RMB) based on the USD/CNY market exchange rate; USD is not rendered in the UI.
  • Display the account balance returned by the official GET /user/balance endpoint, prioritizing the returned CNY balance.
  • Activate the host service and browser display simultaneously via dsh.bundle and dsh.client.
  • Unknown provider/model routes are displayed as “Unpriced” and do not show as zero cost.

Installation and Enablement

The installation command requires pnpm. Run:

dsh plugin --profile web add dsh-token-price

The command above adds dsh-token-price to the DSH Web profile. The plugin will activate the host service and browser display simultaneously.

Configuration Example

The token-price plugin can be configured with the following items:

- id: token-price
  name: dsh-token-price
  config:
    balanceBaseURL: <Balance API URL>
    balanceApiKeyEnv: <Environment variable name to store DeepSeek API key>
    balanceRefreshIntervalMs: <Balance refresh interval, in milliseconds>
    referenceRateRefreshIntervalMs: <Reference rate refresh interval, in milliseconds>
    requestTimeoutMs: <Request timeout, in milliseconds>

Where balanceApiKeyEnv specifies the environment variable to store the DeepSeek API key; the key is retained on the host side. If the balance refresh fails, the last balance sample is retained.

Estimation Methodology

The ¥ amount here is an estimate based on the USD/CNY market exchange rate, not an account deduction, nor the official per-request fee. Unknown provider/model routes are displayed as “Unpriced” and will not be shown as a zero-cost amount.

Development and Build

Run the following during development:

npm install
npm test

npm test builds lib/, generates type declarations, and runs accounting tests. After rebuilding, the DSH Web process needs to be restarted to load the new artifacts. The runtime environment requires Node >=18.

Use Cases and Notes

Suitable for developers or users who wish to view token costs and account balances in the DSH Web chat interface. The plugin runs with the permissions of the current dsh process; you should check the source code and license before installing.

Links

  • Plugin Directory Page: https://www.skillhub.cn/plugins/spoon-man569/dsh-token-price
  • GitHub: https://github.com/spoon-man569/dsh-token-price