@fenzhenhua123/dsh-balance-meter: DeepSeek Harness Balance and Cost Statistics

In the development and debugging of DeepSeek Harness, API account balances and per-session cost consumption are high-frequency concerns. The lack of intuitive statistics can lead to overspending risks or uncertainty regarding billing details. The following introduces the @fenzhenhua123/dsh-balance-meter plugin, which displays the balance and current session costs directly in the statistics bar at the bottom of the session page.

Plugin Positioning

This is a DeepSeek Harness plugin maintained by FenZhenHua. By adding a capsule component to the session statistics bar, it addresses the absence of real-time API balance monitoring and granular cost statistics in the native DSH interface.

Core Features

  1. Balance & Current Cost Capsule: Added next to the “Session Statistics” entry.
  2. API Balance Display: Shows the recharge balance (including bonuses) from the DeepSeek Open Platform; left-click to view details.
  3. Current Session Cost: Accurately accumulated on a per-request basis according to official billing methods.
  4. Current Session Tokens Statistics: Displays data across four buckets: Input Uncached / Cache Read / Cache Write / Output; visible via left-click.
  5. Granular Billing:
    • Per Model: Supports deepseek-v4-pro / deepseek-flash.
    • Per Cache Status: Three-tier billing covering input cache hits / cache misses + writes / output.
    • Per Time Period: Peak/off-peak billing based on Beijing Time; peak price = off-peak × 2.
  6. Automatic Price Refresh: The Host side fetches the official price page and parses the latest unit prices every 6 hours.

Installation and Enablement

  1. Run the installation command:
    dsh plugin add @fenzhenhua123/dsh-balance-meter
  1. Navigate to the “Plugins” page, locate the “Balance & Current Cost” card, and click the toggle to enable/disable it (takes effect immediately, though a browser refresh may be required).

Typical Usage

If the official price fetch fails or if you need to adjust fallback prices, edit the EMBEDDED_PRICING configuration at the top of lib/index.js. The configuration unit is RMB per million tokens (off-peak); peak hours will automatically be multiplied by 2.

Use Cases and Notes

  • Use Cases: Developers who need to precisely control API budgets and monitor different models (Pro/Flash) and cache hit rates.
  • Notes:
    1. Costs are estimated based on official billing rules; actual charges are subject to the platform.
    2. Calculations are performed on the Host side by replaying session logs on a per-request basis.
    3. The plugin runs with Host process privileges. It is recommended to review the source code and license (MIT) before installation.
    4. After the year-end, update the dates for the next year in CN_WEEKDAY_HOLIDAYS_2026 within lib/index.js.

Summary

Through its visual capsule format, this plugin aggregates balance and billing information into the session statistics bar, facilitating cost control. For more details, please refer to the GitHub Repository or the Community Directory.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye