Preface

DeepSeek Harness (dsh for short) splits the agent runtime into “everything is a plugin”: sessions, tools, and interfaces can all be mounted on demand. Most people use its web interface dsh web on a daily basis, which allows you to run tasks while watching the model stream out tokens. Starting from August 17, 2026, DeepSeek’s official API switched to peak-offpeak pricing for the V4 series: Beijing Time 9:00–12:00 and 14:00–18:00 are peak hours, and the rest are off-peak hours. The off-peak price is half of the peak price. For the same conversation, the unit price can differ by a factor of two between coding in the morning and batch processing at night.

The built-in statistics line of dsh reports token usage, but it does not calculate costs according to the official policy, nor does it centralize account balance, session spending, and “how much was saved” by local models. The community plugin dsh-web-billing does exactly this: it automatically calculates prices according to the official policy schedule, keeps track of costs per message, and displays them in real time in the browser.

Two points need to be clarified first. First, the official repository of DeepSeek Harness is at deepseek-ai/deepseek-harness; the plugin directory site deepseek-harness-plugin.com is a community-curated list, and has no official affiliation with DeepSeek / FunPropeller. Do not treat it as an official app store. Second, the fees shown by the plugin are a local ledger estimated based on official unit prices and session usage; actual deductions shall prevail based on the DeepSeek platform bill.

What is this

dsh-web-billing is a session and messaging plugin for dsh web, maintained by bpc-oss, licensed under MIT, and primarily written in JavaScript. The directory page categorizes it under the “Session and Messaging” section; the current version number in the repository’s package.json is 2.1.0, and the GitHub star count was 9 at the time of writing.

The problem it solves is very specific: it displays “how much this reply cost, how much this session has accumulated, and how much account balance remains” in the web interface, and the pricing rules follow the official policy—including the peak-offpeak periods starting August 17, 2026—instead of using a hardcoded price list that may be outdated.

The host subscribes to session/event, and for each assistant/message with usage data, it calculates the price based on the time when the message was completed, and writes the ledger to $DSH_HOME/storages/web-billing.json. The browser side displays cost badges on each assistant message action bar and the session header; a more complete summary is available in Settings → Billing. The Chinese interface defaults to displaying prices in Chinese Yuan ¥, while the English interface uses US Dollars $; you can also force a specific currency via configuration.

Core Features

Automatic Pricing According to Official Policy

The pricing engine is located in lib/pricing.js, with a built-in policy timeline OFFICIAL_PRICING_POLICIES. The RMB unit prices (unit: yuan / million tokens, cache hit / cache miss / output) listed in the README are as follows.

Fixed Price Periods:

Effective Time (Beijing) Policy Unit Price
2025-02-09 Standard prices for deepseek-chat / deepseek-reasoner 0.5/2/8 · 1/4/16
2026-05-22 75% price cut for V4 series, converted to permanent pricing v4-flash 0.02/1/2 · v4-pro 0.025/3/6

Peak-Offpeak Pricing Starting August 17, 2026:

Model Off-Peak Peak
deepseek-v4-flash 0.05 / 1.5 / 4.5 0.10 / 3.0 / 9.0
deepseek-v4-pro 0.15 / 4.5 / 13.5 0.30 / 9.0 / 27.0

This table matches the DeepSeek official pricing page open at the time of writing: peak hours are Beijing Time 9:00–12:00 and 14:00–18:00, and off-peak hours are half of the peak price. The plugin defaults to the Asia/Shanghai time zone, with peak windows [[9,12],[14,18]] (inclusive start, exclusive end).

The pricing semantics are as explained in the repository:
1. Pricing based on message timestamp: Each message uses the policy and peak-offpeak period in effect at the moment it was completed, so no configuration changes are needed after new policies take effect.
2. Policy chain inheritance: Models not explicitly mentioned in a new policy will inherit the pricing from the most recently named policy, ensuring historical bills match the platform’s records.
3. Self-healing after price changes: If the policy table or configuration changes, existing records will be revalued according to the current rules when restarted; the token counts are still stored in the ledger and will not be lost.
4. User override: Entries in prices that specify exact model names will override official prices; the * wildcard only fills in prices for models that the official policy has never covered. Setting officialPricing: off will use only the user’s price list entirely.
5. Extensible policies: If the official adjusts prices in the future, you can append new policies via the policyOverrides configuration without modifying the plugin code.

There are two sets of official unit prices for RMB and USD, not just a simple currency conversion. The policy timeline is curated from official announcements, and the plugin README also notes: if you find discrepancies, please refer to the official page, and pull requests are welcome.

Per-Message Billing and UI Display

Billing occurs on the host side: using (sessionId, messageId) as the primary key, duplicate or replayed events will only overwrite the details without double-counting. The data is persisted with a 1-second debounce and atomic replacement of temporary files; if loading fails, the ledger will start empty and trigger an alert. Each billing record will note the unit price unitPrice used at the time and the pricing mode mode (flat / peak / offPeak).

Two levels of billing information are visible on the browser side:
- A cost badge on each assistant message action bar; hovering over it will show the token breakdown and model used.
- A badge on the session header, with a hover overlay exclusive to this session: today’s and cumulative spending/savings for this session, amounts broken down by model, and Input / Cache Hit Rate / Output; when using DeepSeek series models, it will also indicate whether it is currently peak or off-peak hours.

Today’s, monthly, cumulative, account balance, breakdown by model, breakdown by session, and daily history are all centralized in Settings → Billing. You can select time ranges including Today / This Week / This Month / Last 30 Days / All / Custom Date. The billing page also supports monthly budget progress bars, CSV/JSON export (CSV includes UTF-8 BOM). Please note: range details are based on the most recent transaction window, with the default maxRecent set to 20,000 entries; data older than that will only be retained as daily aggregates.

Account Balance

The host reuses the provider’s API key to call the official read-only interface GET /user/balance (default address: https://api.deepseek.com/user/balance; if DEEPSEEK_BASE_URL is set, it will be used as the prefix). The default refresh interval is 60 seconds, with a 5-second timeout, and failures will degrade silently. The API key is only parsed on the server side and will not be sent to the browser. Balance checking can be toggled on the billing page at runtime without restarting the service.

Coding Plans and Local Models

In addition to directly connecting to the DeepSeek API, you can also attach various coding plans in dsh. The plugin has built-in official USD prices for DSH presets (taken from the Harness built-in pi-ai catalog, see lib/coding-plans.js), routed by (provider, model):
- opencode-go / opencode / kimi-coding: Billed according to the $/1M published by the platform. The displayed RMB price = official USD price × codingUsdCnyRate (default 7.2, this is only for display conversion and does not affect DeepSeek’s own official RMB prices).
- qwen-token-plan / xiaomi-token-plan / zai-coding: The platform does not publish per-token unit prices, and calls are counted at 0 yuan.
- Models not matched in the above two categories will still follow the DeepSeek official policy chain (including peak-offpeak pricing). The same model name under different providers will not have their prices cross-contaminated.

Local (self-hosted) providers can be added to localProviders. Calls to these providers are calculated at “nominal value” based on official prices, while actual costs are based on localCostPerM (default 0, equivalent to free), and the difference is recorded as “saved”. The badge will display text like Saved ¥X.

The billing page also allows you to set the charging model for each provider (takes effect immediately): usage (pay-as-you-go), usage-free (pay-as-you-go but free models are counted at 0), subscription (monthly fee, calls are counted at 0 and amortized), free (event-based free), local (local deployment). After switching, historical records will be immediately revalued.

Installation and Activation

The installation command given on the directory page can be run in the DeepSeek Harness terminal:

dsh plugin add github:bpc-oss/dsh-web-billing

This is a standard DSH bundle. In package.json, dsh.bundle.patch points to the cordis.patch.yml file inside the package, and the client declares platform: web. The repository README recommends explicitly specifying the web profile:

dsh plugin --profile web add github:bpc-oss/dsh-web-billing

For reproducible installations, fix the commit hash according to the directory page instructions. For example, the latest commit on the master branch of the repository at the time of writing is 27f3750d23ee08af1b8aa7d9843d470d26eadf67:

dsh plugin add github:bpc-oss/dsh-web-billing#27f3750d23ee08af1b8aa7d9843d470d26eadf67

You need to restart dsh web for the installation to take effect. Only one instance should run under the same $DSH_HOME; multiple instances will compete to write to the same ledger file. The repository notes: this package is pure JavaScript, and git installation usually does not require building; if pnpm ≥10 prompts about build authorization, add the prompted package keys to the allowBuilds field in the profile’s pnpm-workspace.yaml before trying again.

The plugin runs with the permissions of the current dsh process, and may execute code during installation. Please review the source repository and license agreement before installing.

Typical Usage

The default configuration works out of the box: the official price list is already built into lib/pricing.js. After installing and restarting, you can use it normally during conversations. A cost badge will appear next to each assistant message, and you can see the session’s total spending in the session header; open Settings → Billing to view your balance, detailed breakdowns by model, and export bills.

If you need to override the default configuration, overwrite the entire config using the id web-billing in $DSH_HOME/profiles/web/cordis.patch.yml. The override will replace the entire config, so you need to include all the keys you want to use. Below are the common items from the repository documentation (unit prices are per million tokens):

Key Default Description
displayCurrency auto auto follows the UI language; CNY / USD forces a specific currency
timezone Asia/Shanghai Time zone for peak-offpeak determination
peakWindows [[9,12],[14,18]] Peak hours, [start,end) with inclusive start and exclusive end
officialPricing auto Setting to off will only use user-defined prices
localProviders [] List of local providers
localCostPerM 0 Local actual unit price (¥/1M)
codingUsdCnyRate 7.2 Reference CNY exchange rate for USD prices in coding plans
loopbackOnly true The /billing endpoint only allows loopback access
balance.enabled true Whether to query and display account balance

Note: Hardcoding unit prices for a specific model in prices will freeze the price for that model, even overriding peak-offpeak switching; this is generally not needed. If the official adjusts prices in the future, a more robust approach is to append new policy entries with a since field to policyOverrides.

The billing endpoints default to only listening on loopback: GET /billing/state (supports ?range=...), GET /billing/session/. Runtime configuration can be done via POST /billing/metering, POST /billing/budget, POST /billing/balance, which also default to loopback-only access. Change loopbackOnly to false only if you need to view bills from the local area network; after changing this setting, the plugin uses the same authentication as other GUI routes, and does not implement an additional layer of authorization.

Applicable Scenarios and Notes

This plugin is particularly suitable for the following use cases:
1. Daily use of the DeepSeek official API via dsh web, and you want to view the cost of each message and each session according to the peak-offpeak pricing after August 17.
2. Mixing coding plans, local models, and official APIs in the same Harness instance, and you want to route pricing by provider instead of incorrectly applying the DeepSeek peak-offpeak schedule to glm / kimi and other models.
3. Need monthly budget tracking, CSV/JSON export, or account balance checking, without having to scrape the official pricing page yourself.

There are several boundary conditions to keep in mind when using it:
- The fees shown are estimates. The token counts come from session usage, and the unit prices come from the plugin’s built-in (or your overridden) policy table; discounts, bonus deduction order, taxes, etc. shall prevail based on the DeepSeek platform. If the policy table is outdated, please refer to the official pricing page.
- This is a web-side plugin for dsh web, not a general-purpose CLI billing tool.
- The balance interface uses the official read-only GET /user/balance, and failures will degrade silently, so the balance may not be temporarily visible in the UI.
- The RMB figures for coding plans are converted using the reference exchange rate; the USD amounts are the official true values from the platform.
- The /billing endpoints are only accessible locally by default; turning off the loopback restriction will expose the read-only billing API to the listening address, so please decide based on your network environment.
- The plugin only reads session/event and does not modify session content; however, it still runs with the permissions of the current dsh process. Please review the source code and license before installing, and pin the commit hash in production environments.

Summary

dsh-web-billing integrates DeepSeek’s official policies (including the August 17, 2026 peak-offpeak pricing) into dsh web: the host side records billing based on message timestamps, and the browser side displays spending, balance, savings, and model-specific breakdowns via badges and the Settings → Billing page. The default configuration can keep up with current official unit prices; coding plans and local models use separate routing to avoid price cross-contamination.

Directory page: https://deepseek-harness-plugin.com/zh-CN/plugins/dsh-web-billing/

GitHub: https://github.com/bpc-oss/dsh-web-billing