Introduction¶
When developing or interacting with DeepSeek Harness (DSH) in daily use, it is crucial to keep real-time track of account balance and model call consumption. This plugin aims to provide that information by displaying balance, model usage, and official peak/off-peak pricing, helping users control costs.
What It Is¶
dsh-balance-and-cost is a standard client plugin for DeepSeek Harness (DSH).
- Maintainer: boooooooer
- Category: Client
- License: MIT
- Core value: Displays DeepSeek account balance, model usage, and official time-based pricing.
Core Features¶
The plugin provides the following capabilities:
-
Balance lookup
Queries the balance through theapi.deepseek.com/user/balanceendpoint and displays total balance / top-ups / free credits / availability status. The endpoint has a 60-second cache. -
Usage statistics
Listens forllm/streamevents and accumulates DeepSeek model calls in real time. Statistics are calculated using the official three-category basis (input · cache miss / cache hit / output), distinguishing total usage from current-session usage. Numbers are abbreviated with M/K. -
Model-based pricing
Matches official pricing tables according to the models actually invoked (supports version-suffixed names via prefix matching, e.g.,deepseek-v4-pro-0813); models not covered are estimated usingdeepseek-v4-flash. -
Time-based pricing
Distinguishes peak-hour pricing from off-peak pricing. Peak hours are 9:00-12:00 and 14:00-18:00 Beijing Time; all other hours are off-peak (prices are approximately half of peak pricing). -
Session details
In the Plugin Center, view statistics by model and by session. Each session shows its actual title, total row, and per-model rows. -
Three-category hover
On the homepage summary bar, hover over token numbers to view the three-category breakdown (including the cost for each category); hover over a model name to compare actual consumption for the two main models (flash/pro). -
Export details
Supports one-click CSV export (by model + by session, three-category basis, with BOM so it can be opened directly in Excel). -
Reset records
One-click clearing of all statistics, the balance baseline, and caches, with persistence to disk supported. -
Persistence
Statistics are stored in$DSH_HOME/dsh-balance-and-cost.jsonand automatically restored after a process restart. -
Real-time updates
SSE is used to push usage changes in real time, refreshing the browser immediately; a 15-second polling interval serves as a fallback for disconnections.
Installation and Enablement¶
Install the plugin via the command line:
dsh plugin --profile web add github:boooooooer/dsh-balance-and-cost
After installation, restart dsh to load the plugin.
Usage Examples¶
- Homepage summary bar: Displayed below the input box:
DeepSeek Balance ¥xx.xx CNY · Current Session (model) xx.xM tok ≈¥x.xxx · Total xx.xM tok ≈¥x.xxx · [Peak/Off-Peak]. The model name follows the session’s most recent call, and costs are calculated from plugin installation or record reset. - Hover to view: Hover the mouse over token numbers to display the three-category breakdown for input · cache miss / cache hit / output.
- Plugin Center: Go to “Settings → Plugins” and open the “DeepSeek Usage” tab to view balance details, per-model/per-session statistics, and export CSV.
Notes¶
- Statistics scope: The plugin only counts model calls where the provider contains
deepseek(for example, thedeepseek-officialroute). - Cost estimation: Displayed costs are estimates (official unit price × token usage); actual charges are based on DeepSeek billing.
- Replay calls: Replayed model calls may be counted multiple times.
- Session model display: A session displays the name of the most recently called model, not the currently selected model that has not been called.
Ecosystem Background¶
DeepSeek Harness (DSH) follows the “everything is a plugin” philosophy. This plugin is maintained by community developers and has no official affiliation with DeepSeek / Huanfang.