dsh-liao-usage: Session usage, reference cost, and account balance below the input box

Preface

When running long sessions in DSH, the host’s built-in statistics capsule usually only reports tokens, not the reference cost in RMB, nor does it directly display the account balance next to the input area. Installing a separate billing plugin involving “ledger + polling + self-persistence” tends to be bulky and have compatibility limitations. Furthermore, some projects state they only support older versions of dsh and cannot be installed on the new harness.

Below is an introduction to dsh-liao-usage released by the maintainer oliblue-evan (the community directory entry may appear as dsh-usage-pill): It adds a capsule below the input box summarizing the current session’s token usage, reference costs calculated based on DeepSeek price lists and peak/off-peak tiers, and the account balance. When logged into a DeepSeek account, checking the balance does not require configuring an API Key. The plugin is categorized under admin-security, currently has 0 stars on GitHub, is licensed under MIT, and is at version 1.2.1 (subject to package.json).

What is this

dsh-liao-usage is a host-side half consisting of a single-file client bundle with no extra runtime dependencies: The client reads the tokenUsage projection provided by DSH and the usagePillCost session projection registered by the host; the balance prioritizes the host account’s remote ctx.remote.account.getBalance, falling back to DEEPSEEK_API_KEY and the official /user/balance route only when not logged in. Costs are reference estimates, while balances are returned values from the interface; the panel distinguishes between “actual accrued amount” and “estimated at current price” to avoid treating estimates as billing statements.

Core Features

Bottom Capsule

Displayed below the input box similar to:

🧮 108.0k tok · ¥0.05 · 余 ¥123.45

(Values in screenshots and documentation are examples.) The leading icon indicates peak/off-peak status: a sun for peak hours, a moon for off-peak; the middle shows the current reference cost, and the end shows the account balance. The total token count mainly appears in the expanded panel to avoid duplication with the host’s existing statistics capsule.

Expanded Panel

Clicking to expand reveals details for four buckets (cache hit / miss / write / output), pricing criteria, peak/off-peak countdown, and a timeline of today’s time slots. If the model was changed mid-session, amounts are listed by model ID in addition to the total (shown only when multiple models are present). When DeepSeek does not report “cache write,” the corresponding row is automatically hidden if both tokens and amount are 0.

Balance Source

Path Condition Description
Account Auth Logged into DeepSeek account Reuses host getBalance; keys are not sent to the browser; panel marks source as “Account”
API Key Account returns null Uses DEEPSEEK_API_KEY, 60-second cache, manual refresh bypasses cache; panel marks “API Key”

Balance requests are deduplicated and share a 60-second cache; on failure, the last balance is retained with an indicator, and a retry entry is provided.

Reference Cost Criteria

Under normal circumstances, the host usagePillCost projection is used: each assistant/message / assistant/attempt accumulates based on the peak/off-peak status and model tier at the time of the event, avoiding the rewriting of past expenses due to “retroactively estimating historical usage with current prices” during peak transitions or model switches. If the projection is unavailable, it degrades to “estimation at current price,” which is noted at the bottom of the panel. The built-in price list is identical to that of the community plugin dsh-token-billing; peak hours are Beijing Time Monday to Friday 09:00–12:00, 14:00–18:00 (left-closed, right-open), while weekends and Chinese legal holidays are priced as off-peak.

Settings (1.2.0)

Settings are divided into two card groups: “Bottom Capsule” and “Expanded Details,” featuring instant examples (sample data is clearly marked; it does not query the account or modify the session). It supports one-click restoration of default display settings without touching usage, historical pricing, or account authorization.

Differences from Similar Approaches (Summarized from README)

  • Usage: Reads the host’s tokenUsage projection rather than building a full ledger and periodic polling.
  • Balance: Prioritizes account login; many similar plugins still require users to configure an API Key to view the real balance.
  • Size: Approximately 30 KB level, no build step required; the repository contains 71 assertions (npm test).

This plugin does not build a large ledger for cross-session history or daily statistics; users needing a full billing dashboard with features like dashboards, budgets, or CSV export should choose a more feature-rich plugin and verify the engines.dsh compatibility range themselves.

Installation and Activation

The installation command must come from the repository README; refresh the page after installation:

plugin_manager(action: "install_bundle", target: "github:oliblue-evan/dsh-liao-usage")

The host half inserts into the usage-pill slot via cordis.patch.yml; the client injects into @deepseek-ai/dsh-client-ui-conversation and @deepseek-ai/dsh-api-remotes. peerDependencies requires @deepseek-ai/dsh-api-remotes and @deepseek-ai/dsh-client-ui-conversation to be >=0.2.1-rc.2 <0.3.0-0 (subject to package.json).

Declared in disclosure: May access https://api.deepseek.com; optionally reads environment variable DEEPSEEK_API_KEY (file-0600); supports offlineMode. Please read the source code and license before installing; the plugin runs with the current DSH process permissions.

Typical Usage

  1. Execute the above plugin_manager command in DSH to install the bundle, then reload the page.
  2. Find the usage capsule below the input box; click to open details to view the four token buckets, reference cost @unit price, account balance, and timeline.
  3. To update the balance, use the refresh control in the panel overview; Esc, clicking outside, or the close button collapses the panel (internal refreshes will not accidentally close it).
  4. Adjust capsule and detail display items in the plugin settings; use “Restore Defaults” to reset only UI preferences.

When not logged in and DEEPSEEK_API_KEY is not configured, the balance segment will disappear or explain the reason, but reference costs can still be displayed as long as tokenUsage / usagePillCost is available.

Use Cases and Notes

Suitable for: Users who want to see token buckets, DeepSeek price list RMB references, peak/off-peak status, and account balance simultaneously while doing local DSH long-session development or debugging; users already logged in with a DeepSeek account who want balance queries to bypass self-entered API Keys.

Notes:

  • Displayed costs carry the ≈ symbol and “reference cost” semantics; third-party channels or custom models are still estimated based on built-in DeepSeek rules and do not represent the channel’s actual bill.
  • If the balance is displayed but unavailable, the panel retains the cost entry; network errors will not be falsely reported as “key not configured.”
  • The community plugin directory (e.g., SkillHub) has no official affiliation with DeepSeek / High-Flyer; the directory slug may not match the GitHub repository name. Refer to the repository oliblue-evan/dsh-liao-usage and the README installation target.

Conclusion

dsh-liao-usage consolidates session usage, per-transaction reference costs, peak/off-peak status, and balance into a single capsule below the input box, reusing the host balance interface for the account login path, while deliberately controlling size and dependencies. To learn more, visit the community directory page oliblue-evan/dsh-usage-pill and the source repository github.com/oliblue-evan/dsh-liao-usage.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye