Turn Cost Plugin: Display Per-Turn Cost in DSH Sessions

Introduction

In the conversation logs of DeepSeek Harness (DSH), each response reports its token usage. However, in real-world development or tuning, you often need to know the cost associated with a particular turn of conversation, in order to control spending or assess budgets. The Turn cost plugin adds a cost-estimation line beneath the existing token usage line, displayed in US dollars.

What It Is

Turn cost is a DSH client plugin maintained by felix-tessera. It reads the session data that DSH has already delivered to the browser and appends a cost-estimation line next to each completed response, for example Cost ≈ $0.00516. Clicking the line expands the breakdown: input (cache miss), cache-hit input, and output. Each item shows its unit price and quantity, along with the model used and the billing period (peak / off-peak).

Core Features

  • Adds a cost-estimation line beneath the token usage of every response.
  • Displayed in the format Cost ≈ $0.00516, where ≈ indicates the value is an estimate.
  • Click to expand a three-part breakdown: input (no cache), cache-hit input, and output. Each item lists:
  • Unit price: cost per million tokens (USD).
  • Quantity: the number of tokens in that segment.
  • Model name.
  • Whether it falls within peak hours.
  • Costs are derived directly from the token usage returned by DSH through the same API; no additional estimation is performed.
  • The plugin itself sends no data, makes no network requests, and adds no tools or prompts.
  • The line appears in every display mode, including the “Performance & Usage → Compact” view (where the system’s built-in token line is hidden).

Installation & Enablement

The plugin requires DSH version 0.2.2 or later; compatibility with 0.3.0 and above has not yet been confirmed.

Install via Plugin Index

  1. In DSH, navigate to Plugins → Discover.
  2. Select Add index source and enter:
   https://felix-tessera.github.io/dsh-plugin-token-cost/index.json
  1. Find the Turn cost card in the list and click Install.

The plugin index locks to a specific commit, ensuring you install a reviewed version.

Install via CLI

Use the dsh command in your terminal:

dsh plugin --profile <profile> add github:felix-tessera/dsh-plugin-token-cost

The package is pure JavaScript — no build steps or install scripts are required, and it does not need to be whitelisted in allowBuilds.

To lock to a specific commit, append #<sha> after the repository name:

dsh plugin --profile <profile> add github:felix-tessera/dsh-plugin-token-cost#<sha>

Typical Usage

After installation, in the DSH chat interface, a line reading Cost ≈ $0.00516 appears beneath each completed response. Click the line to view the itemized cost for that turn.

The expanded content includes:

  • Input (cache miss): unit price (per million tokens), quantity, peak status.
  • Cache-hit input: same fields.
  • Output: same fields.

These line items share the same data source as the fields in the system’s token usage line; the plugin only adds currency conversion and a unit-price table.

Use Cases & Notes

Suitable for the following scenarios:

  • Developers who need to control or track per-turn conversation costs.
  • Long conversations where you want a quick estimate of single-turn spending.
  • Using DSH as a debugging or testing environment where you need to inspect per-turn consumption.

Notes:

  • The plugin runs in the browser with DSH’s process privileges, reading already-received session data. Disabling the plugin does not affect conversation logs.
  • Costs are estimates: prices and peak/off-peak definitions are configured in the plugin and do not represent official billing details. If a single turn is routed to multiple models, the price of the first routed model is used.
  • The plugin makes no network requests, uploads no data, and does not send content to any server.
  • To display costs in Chinese Yuan, set CURRENCY = 'CNY' in the client.js file within the installation directory.

Before installing, it is recommended to review the source code and the license (MIT) to confirm it meets your security and compliance requirements.

In Short

The Turn cost plugin provides DSH users with an intuitive per-turn cost estimate and itemized breakdown, helping monitor spending throughout a conversation. For more details and source code, see:

  • Plugin directory page: https://www.skillhub.cn/plugins/felix-tessera/dsh-plugin-token-cost
  • GitHub: https://github.com/felix-tessera/dsh-plugin-token-cost
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye