Introduction¶
When running long conversations or agent tasks in DeepSeek Harness (DSH), account balance and “how much was spent this round” are often scattered across platform pages or rough token statistics. If a session spans lunch break, after-work hours, or weekends, estimating with “current time-slot unit price × total tokens” will not match the platform’s per-request-time pricing results. Below introduces the community plugin dsh-per-request-cost (maintainer Shad0wwa1ker), which displays a compact capsule below the Web input box, simultaneously showing balance, peak/off-peak periods in Beijing time, and the amount consumed by the current session; pricing is primarily based on Host-side per-request projection, and covers sub-agent sessions as well as DeepSeek Search/Fetch billing rules.
What Is This¶
dsh-per-request-cost is a DeepSeek Harness Web interface plugin, classified as admin-security. The capsule’s example form is as follows (values vary with account and session):
¥12.34 · 谷时 · 本次 ¥0.0123
The three types of information correspond to: the account balance after combining recharges and gifts, whether the current moment is within peak or off-peak periods under the official peak-valley rules, and the amount spent by the current session. The plugin does not store credentials; balance is obtained through the Harness’s logged-in account session calling account.getBalance (platform get_user_summary), and no additional requests are made beyond the UI’s existing queries and public holiday data.
Core Features¶
Capsule Three-Item Display and Refresh¶
| Display | Data Source | Refresh Method |
|---|---|---|
| Balance (recharge + gift) | account.getBalance → platform get_user_summary |
On mount, every N seconds (default 60, configurable), at end of each round, manual click |
| Peak/off-peak period | Local clock (Beijing time) | Every 30 seconds, no network requests |
| This session’s consumption | sessionCost Host projection (per-request real pricing); falls back to tokenUsage estimation when projection is unavailable |
Updated in real time after each request settlement |
Recharges and gifts are merged by currency (CNY priority), consistent with platform billing (totaled, gifts deducted first); hovering shows the breakdown. At the end of each conversation round, the balance is refreshed an additional time, not restricted by the “refresh rate” interval.
Per-Session Real Pricing¶
Per-session real pricing means each model request is priced at the peak/off-peak unit price “at the moment the request is sent,” rather than multiplying the entire session’s total tokens by a single time-slot unit price. When a session crosses 12:00, 18:00, weekends, or legal holidays, the total is still accumulated according to the unit price at each request step’s start time.
The formula for a single request is: hits × hit price + (misses + cache writes) × miss price + output × output price (yuan/million tokens). The deepseek-flash price list example is as follows (unit prices are taken from the time slot at the request step’s start time):
| deepseek-flash | Off-peak | Peak |
|---|---|---|
| Input, cache hit | ¥0.02 | ¥0.04 |
| Input, cache miss | ¥1 | ¥2 |
| Output | ¥4 | ¥8 |
The Host folds persistent session logs into a client-visible sessionCost projection: step/start records the billing timestamp; assistant/message / assistant/attempt carry usage, retries are delimited by llm/retry-started and billed separately; request/header provides the model (deepseek-v4-pro uses the Pro price list, unknown models use flash). Folding is executed on the Host; pagination and context compression do not lose already-priced records. If the projection is unavailable (old Host version or sessionProjections not mounted), the frontend estimates based on the entire tokenUsage and the current time slot, with hover indicating “Estimated.”
Peak/off-peak rules are consistent with the official ones: Beijing time Monday to Friday 9:00–12:00, 14:00–18:00 are peak hours; lunch break, weekends, and legal holidays all day are off-peak. Holidays are fetched once per year for the current year, sourced from holiday-cn; when offline or the current year’s announcement has not been published, the built-in 2026 list is used.
Search / Fetch Costs¶
Only DeepSeek’s own search interface is billed per call (¥5 / 1,000 calls, i.e., ¥0.005 per call). The plugin distinguishes by the engine name in the tool result header: Search (deepseek-tools):, Search (deepseek-official): count as DeepSeek search; Search (tavily):, Search (bing): and other third-party engines display as third-party search with amount 0; web_search without an engine header (DSH core tool) is billed as DeepSeek Search API. advanced_search counts as 1 call; multi_search mixes multiple engines and cannot be split, so it is not billed. web_fetch counts as 1 call when the page returns 2xx; errors, empty results, and non-2xx are not counted. Before Beijing time 2026-11-01 00:00, the count is tracked but the amount is 0 (Harness free call period), with hover labeling “Free”; after that, the amount is included on the same basis.
Multi-Agent Sessions¶
Sub-agent model calls are in sub-sessions, each with an independent sessionCost. The parent session capsule lists direct sub-sessions via subagentCatalog and aggregates sub-session projections via sessions.refreshProjections; hovering can show “including N sub-sessions ¥x”, and unloaded ones are marked as “Not loaded” rather than counted as 0. Only direct sub-sessions are aggregated; deeper levels or other workspaces are not included.
Installation and Activation¶
Requires DeepSeek Harness 0.2.x, with a DeepSeek account already logged in (balance comes from the account session, not the API Key).
Method 1 — Plugin management page (Harness ≥ 0.2.1): Open Plugins, install from the directory and point to this package directory; the bundle’s patch will automatically register the plugin entry.
Method 2 — Manual link to profile:
cd "$DSH_PROFILE_DIR" # e.g. ~/.dsh/profiles/desktop
pnpm add link:/absolute/path/to/dsh-per-request-cost
Method 3 — Install directly from GitHub (README recommended):
pnpm add github:Shad0wwa1ker/dsh-per-request-cost
Then add the bundle to that profile’s package.json:
"dsh": { "profile": { "bundles": ["dsh-per-request-cost"] } }
Refresh the page (or restart Harness) to load the browser client module. Host projection takes effect only after the next Harness restart; simply refreshing the page is not enough. The current package version is 1.8.0, license MIT.
Settings and Configuration¶
Open Plugins → dsh-per-request-cost, and modify the balance refresh interval in Refresh rate (10–3600 seconds, default 60); it takes effect immediately after saving. This value is stored locally in the current browser, not written to cordis.patch.yml, and requires no restart. Peak/off-peak display and fallback estimation are at the top of client.js; Host pricing and holidays are at the top of index.js. When DeepSeek adjusts prices, the corresponding price lists can be modified. Built-in holidays can be changed in FALLBACK_HOLIDAYS or the data source address.
Typical Usage¶
After installing and enabling the bundle, simply use Harness for conversations normally: the capsule appears below the input box, updating “this session” consumption along with requests, and the balance refreshes at the configured interval or syncs with each round’s end. To check gift breakdowns, sub-session aggregation, or Search/Fetch counts, hover over the capsule to view the tooltip. If using dsh-free-search etc. to route search to third-party engines, the third-party portion is not included in the DeepSeek bill, and the plugin displays it separately according to the engine header.
Use Cases and Notes¶
Suitable for developers doing long-term development and agent debugging in the DSH Web interface who want to see balance, peak/off-peak periods, and per-request priced session consumption on the same screen. The plugin runs with the permissions of the current DSH process and logged-in session; before installation, you should read the source code and MIT license on GitHub and judge for yourself whether to include it in your profile.
Precision and boundaries (key points from the README’s “Precision Notes”):
- Billing time takes the step start time; before the State Council announces holidays, related working days may still be billed as peak.
- The balance is a snapshot from the most recent refresh, lagging at most by one refresh interval.
- Non-DeepSeek routes (such as Anthropic-compatible providers) are still estimated with DeepSeek unit prices and may deviate.
- The community directory SkillHub plugin page has no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem emphasizes “everything is a plugin,” and this package is community-maintained (about 1 star on GitHub, subject to the directory page).
Conclusion¶
dsh-per-request-cost consolidates account balance, Beijing time peak/off-peak periods, and per-request priced session consumption into a single capsule below the input box, and handles sub-session aggregation and DeepSeek Search/Fetch billing rules, reducing the gap between “estimated tokens” and platform bills. For more information and installation, see the SkillHub directory and the GitHub repository.