Introduction¶
When running main conversations, sub-agents, context compaction, or session title generation in DeepSeek Harness (DSH), tokens flow continuously through multiple routes and for various purposes. The host itself does not come with a complete usage dashboard “since installation, by day/model/project/purpose.” If you rely solely on billing statements or scattered logs, it is difficult to answer questions like “how much did we actually use today,” “how much of it was cache reads,” or “which project consumed the most.”
Below we introduce the community plugin dsh-token-dashboard (maintainer guanhaisen, repository guanhaisen/dsh-token-dashboard). From the moment it is mounted, it records every model call that passes through llm/stream, aggregates and displays the usage. The entry point is at the bottom of the sidebar, directly above the account row; a single click opens the dashboard panel.
What This Is¶
dsh-token-dashboard is a third-party bundle plugin for the DSH desktop profile: it loads from the profile without modifying app.asar or changing any components shipped with the application. The current package version is 0.1.0 (see the repository’s package.json), licensed under MIT; it requires Node >=20 and DSH ^0.2.0-rc.1.
The core problems it solves are: unified usage accounting, complete statistics, and a nearby interface — it is unrelated to ~/.dsh/channel-pack/token-ledger.json used by dsh-our-free-model; the two ledgers do not interfere with each other.
Core Features¶
Recording Scope and Fields¶
Usage comes from llm/stream (LlmRuntime.streamWithRegistration). Main conversations, sub-agents, compaction, and session title generation all pass through the same funnel, so this is not a sampled statistic. Each call records the provider-reported inputTokens / outputTokens, cacheReadTokens / cacheWriteTokens, reasoningTokens (if present), provider / model, purpose (chat / compaction / session-title), sessionId / cwd, durationMs / ttftMs, and ok / error.
Aggregation dimensions include: by day (default day boundary UTC+8), by model, by purpose, by project, plus a recent-calls list sorted newest first.
Accounting Notes (worth knowing before reading the dashboard)¶
- Records forward only, no backfill: calls before mounting are not imported.
- Fields are recorded as-is from the provider; cache read/write are counted separately and are not folded into
inputTokens. - No price conversion: the dashboard reports token composition, not cost.
- The dashboard shows two totals: total tokens = the sum of all four token types (including cache reads); non-cache tokens =
inputTokens + outputTokens. The provider’sinputTokensrefers to input that missed the cache.
Interface and Layout¶
The bottom of the sidebar shows a token usage summary; inside the panel, from top to bottom are the reading area (main metrics and compact KPIs), the daily stacked bar chart, the calendar heatmap of usage over the past year, rankings by model/project/purpose, and recent calls. The layout uses container queries based on panel width, so a narrow main panel reflows even within a wide window. Charts measure their own width to draw the viewBox, preventing labels from being stretched.
Installation and Activation¶
Before installing, please note: the plugin runs with the permissions of the current DSH process, and installing it means introducing third-party code into your profile. It is recommended to read the repository source and the MIT license before deciding to install.
Method A: CLI (fully quit DSH first)¶
The CLI will refuse to modify a profile that is occupied by a running instance.
dsh plugin --profile desktop add github:guanhaisen/dsh-token-dashboard
Method B: Plugin Page¶
- Open Plugins in the sidebar.
- Choose to install, and paste:
github:guanhaisen/dsh-token-dashboard. - Review the pnpm output and confirm.
Method C: Install via Agent¶
Ask the model to install github:guanhaisen/dsh-token-dashboard into the desktop profile; it will use plugin_manager and requires danger-full-access or manual approval.
Pin a Release Version¶
dsh plugin --profile desktop add 'github:guanhaisen/dsh-token-dashboard#v0.1.0'
The installer updates <dsh-home>/profiles/desktop/package.json, writes the bundle into dsh.profile.bundles, and runs the bundled pnpm. If the Desktop build has HMR enabled, no restart is needed — just refresh the page. If the sidebar entry does not appear, check whether dsh.profile.bundles contains "dsh-token-dashboard".
Verify it is running: via plugin_manager { action: "list_plugins" } you should see dsh-token-dashboard with enabled: true and fiberPhase: "active".
Typical Usage¶
After installing and refreshing, daily usage requires no additional commands:
- Click the token usage entry at the bottom of the sidebar to open the dashboard.
- In the reading area, view total tokens, non-cache tokens, cache hit rate, latency, etc. When switching ranges such as “last 7 days” or “last 30 days”, the comparison labels are computed from the calendar series.
- In the daily chart, view the four stacked segments (cache reads, cache writes, input, output); hovering over a column reveals the day’s details.
- In the calendar heatmap, view “which days were busier” over the past year (a fixed one-year window that does not change with range selection).
- In the ranking tables, compare usage by model, project (
cwd), and purpose; “recent calls” only shows records within the currently selected range.
Data is stored by default at:
<dsh-home>/token-dashboard/ledger.json
<dsh-home> is usually ~/.dsh; the directory can be overridden with the environment variable DSH_TOKEN_DASHBOARD_STATE_DIR. Writes are atomic, with 2-second debouncing, and incremental merging across multiple profiles; to clear data, delete the file (the plugin does not provide a clear button).
Configuration¶
Adjust in cordis.patch.yml or overrides in the profile (invalid values are rejected and fall back to defaults, preventing accidental misconfiguration from corrupting history):
| Field | Default | Meaning |
|---|---|---|
retentionDays |
730 |
Number of days to keep daily aggregations |
recentLimit |
300 |
Maximum number of detail records |
utcOffsetMinutes |
480 |
Day-boundary offset (480 = UTC+8) |
trackProjects |
true |
Whether to record the cwd dimension |
flushDebounceMs |
2000 |
Debounce for disk writes (milliseconds) |
Suitable Scenarios and Caveats¶
Suitable for: developers who need to observe token composition over the long term inside DSH, investigate usage by project/model/purpose, and understand the share of cache reads in the total.
Not suitable for (or not yet available): cost budgeting, alerting, or historical backfill imports; the day boundary is a fixed offset (default UTC+8) and does not automatically follow the system timezone.
Known limitations (excerpted from upstream docs): providers that do not report usage still count the request, with zero tokens; multiple attempts from retries are reflected in requests; development and testing have primarily been verified on the Desktop profile.
Conclusion¶
dsh-token-dashboard turns every llm/stream call inside DSH into a queryable ledger and places the dashboard within easy reach in the sidebar. With transparent accounting and no fake billing, it fits the workflow of “see the token composition first, then talk about optimization.”
- Community directory page: https://www.skillhub.cn/plugins/guanhaisen/dsh-token-dashboard
- Source code and full documentation: https://github.com/guanhaisen/dsh-token-dashboard
The community plugin directory is an independent site with no official affiliation with DeepSeek / High-Flyer. Installation and use are at your own risk and compliance judgment.