Preface

When developing with DSH Web, developers can usually see token consumption and duration intuitively, but often lack quantification of “actual cost.” The official interface does not provide a billing entry calculated based on official prices. dsh-turn-cost aims to solve this problem by adding a pricing pill to the native DSH UI, showing per-turn and cumulative costs based on DeepSeek official API prices.

Plugin Overview

This is a pricing plugin for DSH Web, maintained by Quimos-M and licensed under the MIT License. It does not modify the official DSH source code; instead, it appends calculation logic to the interface through public seams. Its core value is converting token consumption into tangible monetary amounts in real time, and supporting detailed views by turn, by session, and by agent.

Core Features

  1. Per-turn and cumulative session costs: Displays cost pills in the session statistics row and on each turn’s action row. The cumulative session cost is the sum of all turns, and the per-turn cost is the total of all requests in that turn.
  2. Itemized cost breakdown: Click a cost pill to view details. The details include token counts and corresponding amounts for cache-hit input, cache-miss input, and output.
  3. Sub-agent cost aggregation: Supports aggregating sub-agent costs into the parent session. The popup supports paginated viewing: page 1 displays the total, and subsequent pages separately display details for the main agent and each sub-agent.
  4. Dynamic pricing and model information: Pricing is based on the model price at the time of the request, automatically distinguishes peak and off-peak periods, and displays the current model information.

Installation and Activation

Install it using the DSH-provided plugin command. Ensure your DSH version is within the compatible range (see the compatibility notes below).

dsh plugin --profile web add link:~/dsh-plugins/dsh-turn-cost

After installation, restart the DSH Web service. The plugin will be loaded automatically.

Usage

  1. View the overview: In the session list, the statistics row below the input box displays “Cumulative session cost.”
  2. View a single turn: In the conversation flow, the end of each response’s action row displays “Per-turn cost.”
  3. View details: Click any cost pill (for example, Cost: 1.23 CNY) to open an itemized details window.
  4. Pagination: Use ← → or click ‹ › to change pages. Page 1 is the total for that turn/session, page 2 is the main agent, and subsequent pages are the individual sub-agents. If there are no sub-agents, no pagination controls are shown.

Pricing Logic and Scope

The costs displayed by this plugin are estimated values calculated by multiplying the token consumption obtained from the DSH interface with DeepSeek official API prices.

  • Pricing precision: Amounts are accumulated as integer micro-yuan and displayed with four decimal places.
  • Peak and off-peak pricing: Supports versioning by model family and effective time, and automatically distinguishes peak and off-peak time windows (peak is weekdays from 09:00 to 12:00 and 14:00 to 18:00, and is 2x the off-peak price).
  • Included scope: Includes costs for standard model requests.
  • Excluded scope:
    • Does not include costs for ancillary calls such as title generation and web search.
    • Does not include costs for non-official providers (such as third-party models accessed through adapters) unless permitted in the configuration.
  • Accuracy statement: This value is only an estimate; actual prices are subject to DeepSeek official documentation and billing statements.

Compatibility and Notes

  • DSH version: Compatible with DSH 0.1.5-rc.1 to 0.2.0-rc.2.
  • Coexistence: The plugin only uses public seams, does not replace or hide native elements, and will not cause DOM conflicts when used alongside other plugins.
  • Uninstallation: To fully remove the plugin, remove dsh-turn-cost from the profile’s bundles and dependencies, then restart.

The dsh-turn-cost plugin provides DSH developers with a transparent, visual cost monitoring solution. You can access the source code and more design details via the GitHub repository.