dsh-turn-cost: Silent Display of Per-Turn Dialogue Cost

Introduction

When debugging locally or running DeepSeek Harness (DSH) for extended periods, the cumulative cost of a single conversational turn can easily be overlooked. Frequent calls to high-priced models can quickly push spending beyond expectations. Existing approaches either require checking the official billing dashboard or relying on external tools, both of which demand switching between interfaces.

Below is an introduction to dsh-turn-cost, a lightweight plugin that displays per-turn conversation costs directly within the DSH client. By default it takes up no visual space; click to reveal the exact amount and pricing details.

What This Is

dsh-turn-cost is a DSH client plugin maintained by Echo-Li130. It places a subtle ¥ button in the action bar of every assistant reply. No amount is displayed by default; clicking the button opens a popover showing the cost of this turn, token statistics for the current call, the pricing tier in effect for the current time window, and the session cumulative total.

Core Features

  • Per-turn cost display: All model calls within the same turn—reasoning, tool invocations, and the final reply—are aggregated into a single turn total.
  • Non-intrusive interaction: Costs are hidden while generation is in progress. The ¥ button becomes clickable only after the charge is recorded, avoiding visual distraction.
  • Peak/off-peak pricing: Peak hours are Beijing time weekdays 09:00–12:00 and 14:00–18:00. All other time slots and weekends are billed at half price.
  • Unpriced models: Models not present in the price list show “Unpriced” in the amount field; tokens are still listed as usual.
  • Language following: UI text language follows the DSH language setting (Chinese / English).
  • Estimates vs. official billing: Amounts are estimates (tokens × official list price). The official bill is authoritative.

Pricing Table & Configuration

The plugin ships with a built-in default price list (peak-hour prices, in CNY per million tokens). To override or adjust prices, set the following under the loader entry with id turn-cost in your profile’s cordis.patch.yml:

- id: turn-cost
  config:
    defaultModel: deepseek-flash
    peakMode: auto            # auto | peak | off-peak
    prices:
      deepseek-flash: { cacheHit: 0.1, cacheMiss: 3, output: 9 }
      deepseek-v4-pro: { cacheHit: 0.3, cacheMiss: 9, output: 27 }
  • defaultModel: Default model id, matching the message.source.model reported by the model adapter.
  • peakMode: Pricing mode. Options: auto (determine tier automatically by time), peak (always use peak pricing), off-peak (always use off-peak pricing).
  • prices: Only list models that need custom pricing. Missing models fall back to the built-in defaults; malformed entries are silently ignored.

Save the file and restart the desktop app for changes to take effect.

Installation & Activation

Use the official install command (DSH 0.2.x Web profile):

dsh plugin --profile web add github:Echo-Li130/dsh-turn-cost

You can also install via the DSH desktop plugin manager by selecting a directory or pasting a directory path. After installation, restart the desktop app (the bundle’s patch is read at startup), then refresh the page.

Typical Usage

  • Trigger a turn with multiple model calls in a conversation (e.g., reasoning, tool invocation, final reply).
  • Locate the action bar of the assistant’s reply and click the subtle ¥ button.
  • The popover displays the current turn number, model, turn total, token breakdown for this call (cache hits, cache-miss input, output), the current pricing tier, and the session cumulative.

Use Cases & Caveats

  • Suited for developers and local-debugging scenarios where you frequently switch models and need to keep an eye on per-turn costs.
  • The plugin runs with the permissions of the current DSH process. Review the source code and license (MIT) before installing.
  • Amounts are estimates and may differ slightly from the official bill.

Summary

dsh-turn-cost tucks each conversation turn’s cost behind a subtle ¥ button, letting developers see per-turn and cumulative spending at a glance without interfering with normal use. To customize prices, override the settings in your profile’s cordis.patch.yml.

  • Directory page: https://www.skillhub.cn/plugins/Echo-Li130/dsh-turn-cost
  • GitHub: https://github.com/Echo-Li130/dsh-turn-cost
羽毛球分组比赛记分
小程序二维码

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

Xiaoye