Introduction

DeepSeek Harness (DSH) uses a plugin-based architecture. When developing or debugging agents in the Web interface, precisely controlling the API call cost of a single session is a common requirement. The dsh-session-cost plugin provides real-time cost statistics based on the official pricing engine, helping developers intuitively monitor the usage of DeepSeek models.

Plugin Overview

This is a session cost plugin for the DeepSeek Harness Web interface, maintained by Lzh3070. It displays the cumulative cost of DeepSeek API calls for the current session next to the input box.

Core Features

  • Real-time cost at the input box: Displays the current session’s DeepSeek API cost in the conversation.input.right slot (to the left of the model selector), refreshing every 5 seconds.
  • Strict model gate: Works only when the current model of the session is DeepSeek. When other models (such as MiniMax or Kimi) are used, the badge is automatically hidden, and requests from non-DeepSeek models are not priced or included in statistics.
  • Hover popup for details: Hovering over the cost badge shows a popup consistent with the interface style, displaying:
    • A session cost breakdown table (input / cache hits / output × quantity × effective unit price = amount).
    • Today’s (DSH) usage: The DeepSeek API cost consumed by local DSH sessions today (Beijing Time).
    • Account balance: Retrieved via the official DeepSeek user/balance endpoint by reading DEEPSEEK_API_KEY from credentials.
  • Official pricing engine: Prices each assistant/message individually according to DeepSeek’s official pricing schedule, based on the time each occurred. Includes peak/off-peak pricing from 2026-08-17 onward (09:00–12:00 / 14:00–18:00 Beijing Time are peak hours; other times are half price), and includes history before the plugin was installed.
  • Performance-friendly: Session logs are cached by revision (5-second polling = one stat comparison, no repeated extraction or parsing); today’s usage and balance update independently every 60 seconds.

Installation and Activation

  1. Run the install command:
dsh plugin --profile web add @phynez_1103/dsh-session-cost
  1. After installation, restart the dsh web service, and perform a hard refresh in the browser (Ctrl+Shift+R) to load the new plugin.
  2. On first use, configure DEEPSEEK_API_KEY under Settings → Models. If not configured, the balance displays as --, but session cost can still be displayed.

Typical Usage

  1. Configure DeepSeek API credentials in Settings.
  2. Switch the current session model to a DeepSeek model.
  3. Interact in the conversation; a cost badge (for example, ¥0.12) appears next to the input box.
  4. Hover over the badge to view the detailed pricing table, today’s usage, and account balance.

Notes

  • Package name distinction: The npm package for this plugin is the scoped @phynez_1103/dsh-session-cost. The bare-name package dsh-session-cost on npm (for example ChengChe106/dsh-session-cost) is another plugin with the same name and is unrelated to this repository.
  • Pricing scope: Only DeepSeek models are priced; other models are neither priced nor displayed.
  • License: The license is MIT.

Conclusion

dsh-session-cost provides a lightweight solution based on the official pricing engine, suitable for developers who need to monitor DeepSeek API cost in the Web interface. For more details, see the GitHub repository or the community directory.