Preface¶
When running multiple API channels and multiple workspace sessions in DeepSeek Harness (DSH), tokens and costs are often scattered across ledger files, session persistence, and channel configurations. The host itself doesn’t necessarily provide a read-only view aggregated by channel, project, or session. If you simply want to see locally “how much was used, where it was spent, and how much balance remains” without writing separate scripts or relying on external SaaS just for viewing numbers, you need a client-side sidebar plugin whose data comes from your local machine and defaults to minimal network access.
Below we introduce the community plugin dsh-key-usage (maintainer: xyl886, category: client-side): it provides a “Usage” panel in the DSH sidebar, showing usage breakdowns by channel, active heatmaps, project and session aggregations, and balance and quota snapshots in the overview (real-time queries preferred, falling back to local snapshots on failure).
What Is This¶
dsh-key-usage is a sidebar usage panel plugin for DeepSeek Harness. The npm package name is dsh-key-usage, current version 0.1.8, license MIT, requires Node.js >= 22, and supports both web and desktop profiles.
In one sentence: it reads the usage ledgers and session projections on your machine, displaying overview, usage details, project usage, by-model usage, and session usage in the sidebar. Costs are displayed according to official billing and built-in pricing rules; if a cost cannot be determined, it shows — rather than guessing. The interface is bilingual (Chinese/English), following the host’s “General → Language” setting, and font size follows the host’s general font size setting.
Directory page: skillhub.cn/plugins/xyl886/dsh-key-usage
Source code and documentation: github.com/xyl886/dsh-key-usage
Core Features¶
Overview¶
- Channel list: one row per channel, including type, today’s and last 30 days’ call counts, balance or subscription window usage, and 30-day cost (with a source badge).
- Channel detail popup (click a channel row): official balance (total / gift / top-up) or subscription window usage (5-hour / weekly / monthly and reset time), query timestamp; on failure, the UI shows “Real-time query failed · View system logs”. Inside the popup you can switch between ¥ / $, refresh exchange rates and pricing, and view the channel’s last-30-day model unit price table (including “Official / Aggregated / Model Official” source badges and “· Partial” hints).
- Activity heatmap: daily tokens for the last 9 months, five intensity levels; weekday columns stay fixed on the left when scrolling horizontally.
Usage Details¶
- Time range: Today / Week / Month / Total / Custom (calendar picker for start and end) + channel dropdown, with full-page linkage.
- Ten stat cards: call count, tokens, input, output, cache read, cache hit rate, daily average tokens, channel count, usage days, cost; each card includes the previous period value and a period-over-period badge (period-over-period is not shown for the entire “Total” range group).
- Channel share bar, daily / hourly charts (single day automatically switches to 24-hour view); hover tooltip is fixed at the top-right of the chart and highlights the corresponding column.
Project Usage, By Model, Session Usage¶
- Aggregated by working directory, channel + model, and individual session respectively; supports search, channel filtering, and sorting.
- Sessions are grouped by date; archived sessions can be shown; sessions without human questions are not displayed. Session names and workspaces align with the host’s session projection; subagent determination is based on the
subagentfield in the projection. - Session detail drawer: first real question, workspace, channel, four token types and hit rate, cost and source badge, per-model share; a 24-hour mini-chart is provided when samples exist.
- The list shows 50 entries on the first screen with a “Load more” option; you can jump from a session row to the corresponding project’s “Project Usage” view.
Export and System Logs¶
- Overview, usage details, projects, models, and sessions all support exporting the current filtered results as CSV (UTF-8 BOM) or JSON.
- Page header log icon: view
$DSH_HOME/dsh-key-usage/plugin.log(JSONL) for pricing refreshes, exchange rates, balance query failure reasons, etc.; supports refresh, copy, export, and clear. Failed conclusions on the page can open the log window in one click.
Costs and Pricing (Summary)¶
Priority order: Official billing (ledger records) → Channel pricing (plugin built-in vendor official pricing; when not listed, matched via channel alias using LiteLLM aggregated prices) → Same-model official pricing (rules such as unique aggregated price hits across the full database). Since 2026-10-16, the “Estimated” layer has been removed; if pricing cannot be determined, — is displayed. Built-in pricing is shipped with the package in data/pricing-catalog.yml; upgrades will overwrite it, and the documentation explicitly states not to manually modify this file. Clicking “Refresh Pricing” fetches a copy of LiteLLM aggregated prices from GitHub / jsDelivr to $DSH_HOME/dsh-key-usage/model-prices.json (validation failures do not overwrite the old file).
Data, Permissions, and Network Access¶
The plugin runs with the permissions of the current DSH process; before installing, it is recommended to review the source code and MIT license yourself to confirm the read/write scope is acceptable.
Primary Read-Only Sources
| Read Target | Purpose |
|---|---|
$DSH_HOME/dsh-usage/usage-ledger.json |
Usage ledger |
$DSH_HOME/dsh-usage/provider-snapshots.json |
Balance / window fallback values |
$DSH_HOME/profiles/<profile>/cordis.yml |
Channel list (text extraction, does not execute !!js) |
Host sessionPersistence |
Project / session / details / by-hour (read-only handle) |
Host credentials / environment variables |
Construct Authorization when querying balance (does not read credential files) |
Write locations (all under $DSH_HOME/dsh-key-usage/): snapshot.json (unified snapshot for all five tabs, recalculated periodically and when opening the page), model-prices.json, fx-rate.json, plugin.log. None of these files contain secrets; host configuration and provider-snapshots.json are read-only; endpoints only accept loopback requests.
Default: no network access. The following three types of actions will access the network, and require you to open the page or click to trigger:
- Opening the plugin page / overview channel detail popup: query official balance or window per channel (if the cache is older than 60 seconds when opening the page, a background re-query is performed; clicking “Refresh” forces a re-query; on failure, falls back to local snapshot).
- Clicking “Refresh Pricing”:
POST /dsh-key-usage/pricing/refresh. - Opening the page / switching display currency / clicking “Refresh Exchange Rate”:
GET /dsh-key-usage/fx(cache can be reused within 12-hour TTL; on further failure, default exchange rate is used and clearly indicated in the UI).
No startup fetching, no periodic polling, no implicit network access on other endpoints.
Installation and Activation¶
Run the official installation command under the corresponding profile (package name dsh-key-usage):
dsh plugin --profile web add dsh-key-usage
dsh plugin --profile desktop add dsh-key-usage
After installation, open “Usage” in the DSH sidebar. The first open will rebuild the snapshot based on the local ledger and sessions; if you need the latest aggregated pricing or exchange rate, use “Refresh Pricing” / “Refresh Exchange Rate” in the UI. Balance queries require the channel to have a configured and available API Key (if not configured, the reason is written to the system log).
Typical Usage¶
- Daily check: Open the sidebar “Usage → Overview”, check today’s / 30-day usage and cost badges for each channel; click a channel row to open the detail popup when balance is needed.
- Investigate a time period: Enter “Usage Details”, select Week / Month or a custom calendar range, filter with the channel dropdown if necessary, and use the ten cards’ period-over-period badges and daily charts to locate anomalous peaks.
- Attribute by project or session: In “Project Usage”, sort and filter by working directory; in “Session Usage”, sort by cost or hit rate, and open session details to see the first question and model composition.
- Offline archiving: Export CSV or JSON under the current filter for use in spreadsheets or your own analysis scripts.
- Troubleshoot failures: When the UI shows “View system logs”, open the log window to check the upstream URL and HTTP status of balance / pricing / exchange rate requests, and retry individual items if necessary.
All steps above are derived from the operation paths described in the plugin README and can be used without additional configuration files.
Applicable Scenarios and Notes¶
Suitable for
- Developers who have already enabled the
dsh-usageledger in DSH and want to view multi-channel tokens, cache hit rates, and costs in a unified way on their local machine. - Users who need to attribute usage by working directory, model, and session dimensions, and want session naming to be consistent with the sidebar.
- Scenarios where you want to occasionally refresh official balance and pricing tables with minimal network access, and accept falling back to local snapshots on failure.
Notes
- The plugin is categorized as client-side, depending on the host’s Node >= 22 and DSH services such as sessionPersistence, credentials, etc.; web / desktop profiles must be installed separately.
- Cost display strictly follows the documented priority; when there is no billing and no pricing match, it shows
—; do not confuse it with vendor console billing. - Pricing rules for peak-off-peak and holidays follow the README (e.g., DeepSeek peak hours are defined as Beijing time working days; the plugin cannot determine holidays, so holidays are charged at peak prices, which is conservative).
- Community directories skillhub.cn and dsh-plugin.org are ecosystem index sites with no official affiliation to DeepSeek / Huanjiao; star and fork counts are as shown on each page at the time (GitHub currently shows 0 stars, 1 fork).
Conclusion¶
dsh-key-usage consolidates the usage ledgers, session projections, and channel configurations already present in DSH locally into a read-only panel in the sidebar: overview with heatmap, ten detail cards and charts, multi-level project / model / session aggregations, and optional balance and pricing refresh. If your pain point is “multiple channels, multiple sessions, but the data is on my machine and hard to see at a glance”, you can start by installing with the commands above, then use it from the overview channel rows and usage detail time ranges.
- Directory page: https://www.skillhub.cn/plugins/xyl886/dsh-key-usage
- GitHub: https://github.com/xyl886/dsh-key-usage