Introduction¶
Under the “everything is a plugin” philosophy of DeepSeek Harness (DSH), developers need a clear view of their current session’s consumption, account balance, and per-model/per-provider cost breakdowns. The traditional approach is to check the usage page or parse logs for statistics — a tedious and non-real-time process. The dsh-plugin-money-widgets introduced below consolidates balance display, per-turn pricing, session totals, a billing panel, and peak/off-peak budget alerts into a single client-side plugin.
What It Is¶
yuzl127/dsh-plugin-money-widgets is a DSH chat UI plugin developed by maintainer Yuzl127, categorized as a “client” plugin. It bundles all money-related widgets into one place, providing a balance tile, per-turn pricing, session totals, a sidebar billing panel, budget alerts, and peak/off-peak reminders. It supports cost breakdowns by model/provider/session and exports to CSV and JSON.
Core Features¶
Balance Tile¶
Displays the remaining DeepSeek account quota (top-up balance + gift balance, by currency) in the status bar below the input box. Clicking it navigates to the usage page. Requires an authenticated account session; it is hidden for pure API-key usage.
Per-Turn Price¶
After each reply is delivered, the action bar on the right shows “This turn: ¥x”. Hovering or clicking reveals the input, cache-read, and output tokens for each model call in that turn, along with their individual costs and the model/provider used.
Session Totals¶
A persistent line below the input box reads “Total: ¥x · In: N · Out: M · Peak/Off-Peak” and grows as the session progresses. Clicking it opens the billing panel.
Billing Panel¶
The sidebar “Billing” panel supports:
- Breakdown by model
- Breakdown by provider
- Daily invoices (aggregated by Beijing-time calendar day; clicking a day expands to show three sub-tables: by session, by model, and by provider)
- Per-call details
- Per-session invoices (most recent sessions)
- Peak/off-peak status
Export options include: current-session CSV / JSON, all-sessions CSV, per-model CSV, per-provider CSV, and daily-invoice CSV (Blob download; CSV includes a BOM so Excel opens it directly).
Budget (Optional)¶
Supports per-turn limits (This turn ¥x / Limit ¥y, turns red when exceeded) and a whole-session budget (Session ¥x / ¥y). session: 0 means disabled.
Peak/Off-Peak Reminders¶
Shows whether the current time is “Peak · Full price” or “Off-peak · Half price” below the input box and in the billing panel. Colors change as a warning within 30 minutes of a transition (can be disabled in settings).
Prices are calculated according to DeepSeek’s official rate card, automatically distinguishing peak hours (Beijing time, weekdays 9–12 and 14–18) from off-peak hours (all other times, half price).
Data Sources¶
- The real-time widgets (balance, per-turn price, session totals) read from the host’s projection service and account service.
- The sidebar “Billing” panel reads a new read-only route
GET /plugins/money-widgets/bills: the host directly scans<DSH_HOME>/sessions/*/session-*/session.v4.jsonl.zstd(multi-frame zstd, decompressed frame by frame), aggregates byassistant/messageusage andmessage.source.provider/model. This means historical sessions also have accessible billing data, independent of whether the host has loaded them. Daily invoices are bucketed by the Beijing-time calendar day on which events occurred (YYYY-MM-DD). - This route is read-only, GET-only, and writes no files. Access is gated by the host Connection trust fence (
ctx.connection.requestRejection, Host/Origin validation + browser auth). In combinations without a Connection service, it falls back to a same-origin Origin/Host comparison.
Installation & Activation¶
dsh plugin add dsh-plugin-money-widgets
Or search for and install it from the DSH plugin marketplace. For development, you can also point to a local directory:
dsh plugin add file:/absolute/path/to/dsh-plugin-money-widgets
After installing, fully quit the client and restart it (a client bundle change cannot be picked up with F5).
Configuration¶
The config field under the money-widgets entry in cordis.patch.yml supports:
prices: Override per-model unit prices (peak-hour price, CNY per million tokens; fieldscacheHit/cacheMiss/output)peakMode:auto(default) |peak(all peak) |off-peak(all off-peak)defaultModel: Fallback pricing for unknown models (defaults todeepseek-flash)budget:{ enabled, perTurn, mode, session }— per-turn limit and whole-session budget (session: 0means disabled)remind:{ peak, leadMinutes }— reminder before peak/off-peak transitions
The Settings page (Settings → Plugins → this plugin) lets you change limits and toggle reminders directly. Saving writes to the current profile; no restart required.
Notes¶
- The balance tile depends on the host’s
remote.accountservice; cost display depends on the host’ssessionProjectionsservice. - Two projections are registered:
cost(per-call details,summary: false, not included in session list rows) andcostSummary(aggregated by model/provider, included in session list rows, consumed by the “session billing” view). - Provider name is taken from
message.source.providerinassistant/message; if the field is absent in older logs, it is recorded asunknown(a change in projectionstateVersiontriggers recalculation). - No token or API key is required; balance display relies on the account login session.
Use Cases & Caveats¶
Ideal for developers who need to check account balance, per-turn cost, and session totals in real time, and who want per-model/per-provider cost breakdowns with exportable invoices. The plugin runs with the current dsh process privileges — review the source code and license before installing.
In Summary¶
This plugin unifies balance, pricing, billing, budget, and peak/off-peak reminders into a single client-side plugin, well-suited for developers who need fine-grained cost control.
Catalog: https://www.skillhub.cn/plugins/Yuzl127/dsh-plugin-money-widgets
GitHub: https://github.com/Yuzl127/dsh-plugin-money-widgets