dsh-abacus (Abacus): DSH Usage Ledger and Account Monitoring

Preface

When running multi-vendor and multi-model configurations in DeepSeek Harness (DSH), token consumption is scattered across session events, while account balances and coding plans reside on various open platforms or login states. Relying solely on the host’s native interface makes it difficult to see “how much was used today,” “how much was spent on the current conversation,” and “how much balance or plan quota remains” on a single screen.

The community plugin dsh-abacus (Abacus, maintained by SereneJi) records the usage of every model call into a local ledger and displays the same data in three locations across the Web GUI and the official desktop client. It also queries vendor balances and plans according to configuration and marks the interface when quotas run low. The following sections cover its positioning, features, installation, and usage notes.

What is this

dsh-abacus is a usage statistics and account monitoring plugin for DSH, categorized under admin-security. The current version is 2.0.0, requiring DSH ≥ 0.2.0-rc.2, licensed under MIT.

Data comes from only two sources: DSH session events (usage) and vendor APIs (balances and plans). Balances and plans are not estimated locally; if they cannot be found, the interface will specify the reason.

Prior to 2.0.0, the plugin was named dsh-usage-stat. The plugin ID, HTTP route prefix, and state directory have all been changed from usage-stat to abacus. An in-place upgrade is not supported; you must uninstall the old version before installing the new one.

Interface and Entry Points

The same ledger appears in three locations:

Location Format
Bottom-left of the sidebar When collapsed: a single line “Today’s usage + Total”. When expanded: listed by vendor and model; a red dot appears before the corresponding vendor when the quota is low.
Below the input box A “Current conversation N tokens” pill; clicking it reveals a breakdown by vendor and model for the current segment.
Settings → Usage Statistics Four tabs: Usage, Cost, Account, Settings.

The settings entry is fixed as Settings → Usage Statistics.

Core Features

Usage Statistics

  • Usage Tab: Summarizes total tokens, input, output, cache reads, and call counts (cache writes are displayed only if they appeared within the window); breakdown by vendor and model; daily bar chart for the selected time range. The top allows switching between Today, Last 7 days, Last 30 days, All, or a custom start/end date.
  • Bar Chart Y-Axis: For multi-day windows, it uses a relative scale (the highest usage day in the window fills the bar), with the anchor point noted in the top-right corner of the card. Selecting “Today” or a single day changes to a 24-column chart by hour.
  • Current Conversation: Breakdowns by vendor are available only for conversations initiated after the plugin is enabled; for earlier conversations where only total amounts are retained, the panel will state “Only total records available”.

Accounts and Plans

  • Account Tab: Displays account balances and plan windows for each vendor in a merged view. Balances are shown by currency, while plans show usage percentages and reset times for the 5-hour, this week, and this month windows. Issues such as missing keys, account logins, unofficial endpoints, or vendors not providing data will be collapsed at the bottom of the card with an explanation.
  • Balances and plans cover only the known endpoints described in the README; the plugin will not convert local token counts into balance estimates for other vendors.

Cost Reference

  • Cost Tab: Converts tokens in the selected window to monetary amounts based on a price list. The scope can be all, a specific vendor, or a specific model; single-day windows support conversion by hour. Models without a set price are listed separately with their token count not counted, rather than being counted as 0 in the total.
  • Amounts are standard price references and do not include discounts, plans, or relay markups. The off-peak prices for two tiers of DeepSeek models are built-in; Beijing time weekdays 9:00–12:00 and 14:00–18:00 are billed at double the rate, while weekends and statutory holidays are billed at the off-peak rate, determined by the time of each invocation. The price list supports multiple price rows with a from effective date; historical amounts are recalculated based on the current price list after a price change (this does not write back to the ledger).
  • The built-in price list and holiday list are periodically fetched from official pages and cached locally; if fetching fails, the last or built-in data is used.

Low Quota Alerts and History Backfill

  • Low Quota Alerts: Thresholds can be set for balances and the three plan windows respectively. When the value is below the threshold, a red dot appears on the bottom-left card and in the account page; a threshold of 0 means that item will not alert. The check is “less than” rather than “equal to”; vendors with no credentials or unqueryable numbers will not be marked with a red dot. This is an interface mark only, with no popups or sounds.
  • History Backfill: The plugin only records usage during its runtime; upon first enabling, it automatically backfills past sessions from the DSH disk. After disabling the plugin midway, you can manually trigger another backfill in the settings page. Backfill accounts entries by the day the invocation occurred. Only sessions where DSH logs still exist can be recovered.

Installation and Activation

Requires DSH 0.2.0-rc.2 or higher. Both the Web GUI and the official desktop client are supported. Replace --profile with your current profile name (usually desktop for the desktop client, usually web for dsh web).

Install from GitHub:

dsh plugin --profile desktop add git+https://github.com/SereneJi/dsh-abacus.git

Uninstall:

dsh plugin --profile desktop remove dsh-abacus

Host-side changes require a DSH restart; subsequent interface changes only require a page refresh.

Migrating from dsh-usage-stat

dsh plugin --profile desktop remove dsh-usage-stat
dsh plugin --profile desktop add git+https://github.com/SereneJi/dsh-abacus.git

If $DSH_HOME/abacus/ does not exist, the first startup will copy the entire $DSH_HOME/usage-stat/ directory to become the new ledger directory, retaining the old directory as a backup. Interface preferences in the browser will be migrated once from dsh-usage-stat.* to dsh-abacus.*.

Configuration and Data Paths

Items in the settings page correspond to $DSH_HOME/abacus/config.json ($DSH_HOME defaults to ~/.dsh). Common keys include:

Key Default Meaning
enabled true Master switch; when off, no recording, no probing, interface disappears
pollIntervalSec 60 Interface usage refresh interval (5–600 seconds)
probeEnabled true Whether to query vendor balances and plans
probeIntervalSec 300 Balance and plan query interval (60–3600 seconds)
alertEnabled true Master switch for low quota alerts
alertBalanceBelow etc. 0 Alert when balance or plan windows are below threshold; 0 means no alert
prices DeepSeek official two tiers (off-peak price) Price list; can configure input / output / cacheRead / cacheWrite (CNY) per million tokens by model

The price list can also be written directly in the configuration file, for example:

"prices": {
  "deepseek-flash": { "input": 2, "output": 8, "cacheRead": 0.04, "cacheWrite": 2 }
}

Local data files:

Path Content
$DSH_HOME/abacus/usage.json Usage ledger
$DSH_HOME/abacus/providers.json Balance and plan snapshots
$DSH_HOME/abacus/upstream.json Fetched price list and holiday list
$DSH_HOME/abacus/config.json Configuration

Vendor API keys are stored by the DSH credential service and read only on the host side; they will not enter the browser.

Typical Usage

  1. Install via the command above and restart DSH. Open Settings → Usage Statistics and confirm whether the time range and details on the usage page meet expectations.
  2. If balance and plan display is needed, keep probeEnabled as true and configure an API key with queryable balance for the corresponding vendor in DSH; vendors requiring account login may not be able to display open platform balances—refer to the interface description for details.
  3. Configure low quota alert thresholds and custom price lists in the settings page; the cost page is for reference only and should not be confused with official billing.
  4. Upon first installation or if the plugin has been disabled, check the history backfill status in the settings page and manually trigger a backfill if necessary.

Use Cases and Notes

Suitable for users who need to view token ledgers, conversation-level usage, and account balances long-term in the DSH sidebar and settings, and are willing to retain complete history locally (the ledger has no time or volume limits, only a fallback limit on the number of session rows).

Please note before installation: The plugin runs with the current dsh process permissions, reads and writes to $DSH_HOME/abacus/, and may initiate balance queries to vendors. Before installation, you should review the GitHub repository source code and MIT license yourself. The community directory SkillHub Plugin Page is an independent site and has no official affiliation with DeepSeek / High-Flyer.

Other known limitations include: The chart’s daily view can go back up to 366 days; interface text is selected between the plugin’s built-in zh/en based on browser language; the sidebar card relies on the DSH DOM structure, and if injection fails, it degrades to being appended to the bottom of the sidebar.

Conclusion

dsh-abacus consolidates usage, cost references, accounts, and plans into a single local ledger and settings page, making it suitable as a daily development usage ledger for DSH. For more information, see the SkillHub Directory Page and GitHub: SereneJi/dsh-abacus.

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

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

Xiaoye