Introduction¶
DeepSeek Harness (DSH) only provides session logs by default, with no centralized entry point for viewing daily Token consumption and model breakdowns. Over long-term usage, when you need to understand per-model costs, evaluate trends, or export reports, you have to manually extract data from the logs. This plugin aggregates daily consumption and model breakdowns from local session logs, displayed in a dashboard style similar to z.ai / Claude, making it easy to quickly identify costs and usage patterns.
What Is It¶
dsh-usage-dashboard is a client-side plugin designed for DeepSeek Harness 0.2.x, maintained by fairyqinglan. It reads local session logs and aggregates daily Token consumption, model distribution, trend charts, and export functionality. All calculations are performed locally with no network requests (except for balance checks).
Core Features¶
Sidebar Pop-out View¶
At the bottom of the sidebar, above the chart button, today’s total Token count is displayed. Clicking it opens a pop-out panel containing:
- Model distribution donut chart
- 14-day smoothed trend chart
- Per-model percentage list
- DeepSeek wallet balance (requires the account plugin to be installed and logged in)
- One-click CSV export
Clicking on a specific day in the trend chart smoothly transitions the donut chart and list to that day’s model breakdown. Click again or use “Clear selection” to return to the 14-day summary.
Full Dashboard in Settings Page¶
Navigate to “Settings → Usage Statistics” to view the full panel:
| Section | Content |
|---|---|
| Overview Bar | Total, peak day, today, current streak, longest streak (displays 亿/万 units under Chinese locale) |
| Period Comparison | Year-over-year and month-over-month Token deltas, with ▲/▼ symbols and percentages; marked as unavailable when history is insufficient |
| Token Activity Heatmap | Full-year GitHub-style heatmap (one cell per day), blue intensity adapts to theme, clicking a day updates the donut chart |
| Token Distribution Donut | Closed ring + center total, listing each model’s Token spend and percentage; defaults to today or the day selected via heatmap/trend chart, with arc animation on switch |
| Time Range | 7/30/90-day presets, or custom start/end dates; presets use local slicing, custom ranges trigger a re-query |
| Daily Trend | One smooth multi-colored curve per major model, plus “Others”; clicking a day shows that day’s breakdown in the donut chart, keyboard accessible |
| Model Table | Shown per route: input/output/cache read/cache write/call count/total/percentage |
| Export | Export daily per-model rows for the current window as CSV or JSON |
API & Export¶
Both API routes require Harness connection trust-wall authentication:
GET /api/token-usage-dashboard/summary?days=N&from=YYYY-MM-DD&to=YYYY-MM-DD&compare=1&compareDays=NGET /api/token-usage-dashboard/export?days=N&from=YYYY-MM-DD&to=YYYY-MM-DD&format=csv|json
Parameters:
- days=N: Backward day window (default 30, max 365)
- from / to: Absolute date range, truncated to the retention window
- refresh=1: Force cold refresh
- compare=1: Return a comparison object in summary
- compareDays=N: Comparison window (default 7)
- format=csv|json: Export format (default CSV)
Export file name is token-usage-YYYY-MM-DD.{csv,json}.
How It Works & Performance¶
- Data source:
assistant/messageevents in session logs, carryingusageandprovider/modelrouting. The plugin only folds these events and does not write to logs. - Incremental folding: Attached sessions are incrementally folded via
ctx.sessionProjectionsand persisted to the projection cache; offline sessions are read directly from cache, with only uncached rows cold-folded once from logs. - Cold-folding optimization: Only reads the latest events (bounded tail), uses
eventCountmetadata to locate the starting point, avoiding missed recent usage in large logs. - Fault tolerance: Failed projection registration falls back to local folding; failed cache reads fall back to logs; failed log folding skips the session. All HTTP paths are wrapped and do not bubble up.
- State limits: Day buckets retain at most 365 days; daily model routes retain at most 48 entries, ensuring persisted state doesn’t grow too large.
Privacy & Security¶
- Token usage data is only read from local session logs and is never sent to any external party.
- Wallet balance is the only network read, fetched by the account plugin through an authenticated Platform connection (
deepseekAccount.getBalance). This plugin holds no tokens, does not call Platform directly, and does not maintain a network client. - Both API routes sit behind the Harness trust wall; unauthenticated requests are rejected before reaching the handler.
- The code contains no credentials,
process.env, telemetry, or remote code. - Aggregation involves only event types, usage numbers, route IDs, and timestamps — it never reads prompt or response content.
Installation & Enablement¶
Install¶
Requires DeepSeek Harness 0.2.x (Cordis sessionProjections / sessionProjectionCache / sessionPersistence interfaces).
dsh plugin --profile <profile> add github:fairyqinglan/dsh-usage-dashboard
Replace <profile> with your configuration profile name (web for dsh web, desktop for the desktop app).
Configure bundles & patch¶
Add the bundle in your config file:
{
"dsh": {
"profile": {
"bundles": [
"@local/dsh-usage-dashboard"
]
}
}
}
Insert the patch in cordis.patch.yml:
- insert:
- id: usage-dashboard
name: '@local/dsh-usage-dashboard'
Restart DeepSeek Harness (or toggle the plugin in plugin management).
On first dashboard open, the data directory will create a usageDashboard row per session under C:\Users\<you>\.dsh\storages\session_projcache\; first load for large logs may take a few seconds.
Typical Usage¶
- Open the bottom of the sidebar and click the chart button to view today’s summary and 14-day trend.
- In the settings page, select “Usage Statistics”, adjust the time range (e.g., 30 days), and view the heatmap and trend lines.
- Click a day on the heatmap or trend chart — the donut chart and model list will transition to that day’s breakdown.
- Check the model table for per-route input/output/cache read/cache write/calls/total/percentage.
- Click the “Export” button to download the current window’s CSV or JSON file for further analysis.
Use Cases & Notes¶
Suitable for DSH users who need centralized viewing, statistics, and export of Token usage, especially those running multiple models in parallel or requiring daily/per-model cost analysis or compliance auditing.
Notes:
- The plugin runs with the current DSH process privileges; ensure read access to the session log directory.
- It is recommended to review the source code and LICENSE (MIT) before installation.
- If the DeepSeek account plugin is not installed or you are not logged in, the balance will show as unavailable.
Conclusion¶
dsh-usage-dashboard performs local Token aggregation and visualization of session logs, providing a unified experience from the sidebar pop-out view to the full settings-page dashboard, supporting per-model breakdown, trends, and export. For DSH users who need to manage costs and usage patterns, it is a lightweight and controllable complement.
- Directory: https://www.skillhub.cn/plugins/fairyqinglan/dsh-usage-dashboard
- GitHub: https://github.com/fairyqinglan/dsh-usage-dashboard