Foreword

When running dsh web or the desktop version in DeepSeek Harness (DSH), model invocations continuously consume tokens. While the DeepSeek console provides official billing, local sessions lack intuitive visibility into metrics like “cost of this message,” “monthly cumulative cost,” or “whether to switch models during peak/off-peak hours.” Manual comparison with official pricing pages and personal spreadsheets is time-consuming and error-prone.

dsh-web-billing is a DSH bundle plugin maintained by community contributor bpc-oss, designed for the dsh web scenario. It provides per-message accounting in the browser, automatic pricing based on official policies (including peak/off-peak pricing), account balance display, and a cost summary page. SkillHub classifies it under admin-security; the GitHub repository currently has approximately 11 stars, an MIT license, and the latest version is 2.3.2.

Important Note: The plugin tracks completed assistant/message events captured locally by DSH, not the official usage bills from the DeepSeek account. For cross-API key reconciliation, refer to the official Usage export in the DeepSeek console.

What Is This

One-line description: A RMB/USD token billing plugin for DeepSeek Harness Web—automatically calculates costs based on official policies (built-in policy timeline includes peak/off-peak pricing from 2026-08-17), provides per-message accounting, displays real-time account balance, and automatically switches ¥/$ display based on the interface language.

The plugin is distributed as a standard DSH bundle (dsh.bundle.patch points to cordis.patch.yml within the package), requires Node.js ≥20, and depends on @deepseek-ai/schemastery and @deepseek-ai/dsh-home-paths.

Core Features

Official Policy Automatic Pricing (Peak/Off-Peak Following)

lib/pricing.js contains the OFFICIAL_PRICING_POLICIES price timeline, where each policy has an effective time (since) and a unit price table. Known policy milestones include:

Effective Time (Beijing) Policy
2025-02-09 Standard pricing for deepseek-chat / deepseek-reasoner
2026-05-22 V4 series 75% price reduction made permanent
2026-08-17 Peak/off-peak pricing (Peak: 09:00–12:00 / 14:00–18:00 Beijing time; Off-peak half price)

Key semantics of pricing:

  1. Price based on message completion time: Each message is priced according to the policy and peak/off-peak period in effect at its completion time. Automatically switches when new policies take effect.
  2. Policy chain inheritance: Models not explicitly mentioned in new policies inherit the most recently specified price.
  3. Self-healing on price changes: After policy table or configuration changes, all existing records are re-evaluated upon restart based on current rules.
  4. User overrides: Exact model entries in prices override official prices; setting officialPricing: off uses the user price table exclusively.
  5. Extensible timeline: Add policies via policyOverrides in configuration without code changes.

The policy timeline is curated from the DeepSeek API Docs pricing page. Submit PRs to the repository if discrepancies are found.

Coding Plan Billing

Beyond DeepSeek’s official API, the plugin supports various DSH built-in coding plans (e.g., opencode-go, opencode, kimi-coding, and token subscription packages from Qwen / Xiaomi / Z.ai). The price table in lib/coding-plans.js routes pricing by (provider, model):

  • Platform official prices: USD unit prices come from platform releases; RMB display price = USD price × codingUsdCnyRate (default 7.2, for display conversion only).
  • Subscription token packages: Platforms don’t publish per-token unit prices, so calls are billed at 0.
  • After upgrading DSH, run node scripts/sync-coding-plans.mjs to regenerate the price table from the local DSH built-in catalog.

Provider Billing Modes (Metering)

Each provider can have its own billing mode (Settings → Billing → Provider Billing Mode, takes effect immediately):

Mode Description
usage Calculates cost based on official/platform prices
usage-free Usage-based, but calls to free models on the list are billed at 0
subscription Monthly fixed fee; calls billed at 0; nominal price converted to a “break-even” perspective
free Promotionally free; calls billed at 0
local Locally deployed; calls billed at 0

After switching billing modes, all historical records are re-evaluated immediately without restart.

Billing Page and Session Badge

Settings → Billing provides a browser-based summary page with time period filters (Today / This Week / This Month / Last 30 Days / All / Custom), overview and source composition, token statistics (including cache hit rate), source grouping (Local Deployment Savings / Subscription Break-even / Free / Usage-based), monthly budget, CSV/JSON export, and ledger consistency self-check.

Session header badge (top right corner) displays today’s / cumulative cost and savings for the session, per-model statistics, DeepSeek peak/off-peak hints, and a toggleable official account balance row.

Account Balance and Pricing Intelligence

Balance is fetched via the provider’s API key calling GET /user/balance (default 60s refresh). On instantaneous failure, the last successful value is retained, and retries occur automatically.

The pricing field in /billing/state provides current unit prices (currentUnitPrices), the next peak/off-peak or policy transition time (nextTransitionAt), and other pricing intelligence for client-side and external tool use.

Installation and Activation

The plugin offers three installation methods—choose one:

# Install from GitHub
dsh plugin --profile web add github:bpc-oss/dsh-web-billing

# Install from npm (after publication)
dsh plugin --profile web add dsh-web-billing

# Local development: link checkout
powershell -ExecutionPolicy Bypass -File scripts/install.ps1 -Profile web

After installation, restart dsh web for changes to take effect. Only run one instance per $DSH_HOME; multiple instances will conflict on the same ledger file.

If git installation requires build authorization with pnpm ≥10, add the prompted package key to the profile’s pnpm-workspace.yaml under allowBuilds and retry. This package is pure JS and typically doesn’t require building.

To override default configuration, edit $DSH_HOME/profiles/web/cordis.patch.yml by overwriting entire lines by id (overrides replace the entire config, so all keys must be restated). Common configuration options:

Key Default Description
currency CNY Currency identifier
displayCurrency auto Follows interface language; force with CNY/USD
timezone Asia/Shanghai Timezone for peak/off-peak determination
peakWindows [[9,12],[14,18]] Peak hours (local time)
officialPricing auto Automatic pricing based on official policies; off uses only prices
codingUsdCnyRate 7.2 Reference RMB exchange rate for coding plan USD prices
persistPath ~/.dsh/storages/web-billing.json Ledger file path
balance.enabled true Whether to query and display account balance

For full configuration options, see the GitHub README.

Typical Usage

View Cost Summary

After installing and restarting dsh web, open Settings → Billing. By default, it shows this month’s cost, token statistics, and source composition. Switch time periods as needed or set a monthly budget (¥) to observe progress.

Switch Provider Billing Modes

In the Provider Billing Mode section of the billing page, select usage, usage-free, subscription, free, or local for different providers. Historical records are re-evaluated immediately after switching; subscription provider calls are converted to a “break-even” perspective.

Sync Coding Plans and Free Model Lists

After upgrading DSH, execute in the plugin directory:

node scripts/sync-coding-plans.mjs
node scripts/sync-promo-models.mjs

The first updates coding plan USD unit prices from the local DSH built-in catalog; the second syncs free model lists for each provider (see lib/promo-models.js).

Customize Prices or Add Policies

Set prices in cordis.patch.yml to override specific model unit prices, or add official policy entries via policyOverrides (since is required). Set officialPricing: off to use the user price table exclusively.

Export Bills

The billing page supports one-click download in CSV (UTF-8 BOM) and JSON formats for offline reconciliation or integration with other tools.

Use Cases and Notes

Who It’s For:

  • Long-term users of dsh web with DeepSeek and various coding plans, needing local visibility into token costs and savings statistics.
  • Those requiring automatic following of official peak/off-peak pricing, historical bill re-evaluation, or provider-specific billing logic for usage / subscription / local / free modes.
  • Users wanting real-time display of session cost and official account balance in the session interface.

Notes:

  1. The plugin runs with the current dsh web process permissions. Before installation, review the source code and MIT license to confirm the /billing endpoint defaults to loopbackOnly: true (accessible only from loopback addresses).
  2. Local statistics differ from DeepSeek’s official billing metrics; balance comes from /user/balance and only reflects the account corresponding to the currently configured API key.
  3. The ledger writes to a JSON file under $DSH_HOME; concurrent multi-instance usage will corrupt data.
  4. The SkillHub directory (skillhub.cn) is a community plugin index with no official affiliation to DeepSeek / High-Flyer.

Conclusion

dsh-web-billing makes AI expenses in DSH Web “visible and calculable”: automatic official price following, peak/off-peak awareness, per-message ledger, and dual display via billing page and session badge. If you need local token billing and budget management in the Harness ecosystem, follow the steps above to install and try it out.