Introduction¶
When using DSH (DeepSeek Harness) with official accounts or self-hosted relays, model invocations are scattered across session logs. The console often only displays individual conversations, making it difficult to aggregate request counts and token usage by day, interface, or model. Calculating costs based on price lists usually requires manually digging through logs or keeping separate records.
dsh-usage-insights is a community plugin maintained by Ayowait. It adds a “Usage Insights” page to the DSH settings sidebar. It records every model invocation from both official and third-party providers into a local ledger and displays statistics and details in a UI style resembling the official DeepSeek usage page. Data remains local under $DSH_HOME, is not uploaded to the internet, and message content is not recorded.
What is this¶
The plugin is named dsh-usage-insights (matching the npm package name) and is categorized under admin-security in the community directory. It mounts Host and Client components on DSH 0.2.x (Desktop / Web) via Cordis patches: the Host handles event collection, history backfill, and HTTP APIs, while the Client injects the settings page and sidebar entry.
The problems it solves can be summarized in three points:
1. Full statistics for three types of calls: turn, compaction, and title.
2. Differentiation between official providers (e.g., deepseek-account) and third-party relays.
3. Local cost estimation, unit price adjustment, and CSV export.
Core Features¶
Based on the capabilities outlined in the README, here are the features. Characteristics not present in the source materials are not expanded upon.
Recording and Classification
- Every model invocation is written to the ledger with fields including provider, model, input/output, cacheRead/cacheWrite, kind (turn / compaction / title), etc. Prompts, replies, tool arguments, or API keys are not recorded.
- Upon installation, it automatically scans existing session logs under
$DSH_HOME/sessionsfor history backfill, and subsequently performs incremental reads. The ledger is stored atstorages/dsh-usage-insights/events.jsonl, deduplicated by ID with append-only writes.
Display and Filtering
- The settings page offers time ranges of the last 7 / 30 / 90 days and “All,” with filtering available by interface and model.
- It includes three statistics cards, bar charts (Cost / Tokens / API Requests), area charts by model, and a list of recent request details. The UI layout references the official usage page (see screenshots in the repository’s
docs/).
Costs and Export
- Built-in pricing for DeepSeek Flash / Pro (RMB / million tokens). Official models are calculated based on Beijing time peak/off-peak rates (double pricing during weekdays 9–12, 14–18). Unknown models are estimated using Flash pricing and marked as “Estimated.”
- “Price Settings” allows per-model modification of three unit prices: cache hit, input (miss), and output. History is recalculated immediately after changes.
- Supports exporting CSV files with BOM based on current filter conditions, for easy opening in Excel.
Local HTTP API
Available for the settings page or local curl usage, with a base URL of http://127.0.0.1:<port>. Examples:
GET /dsh-usage/api/v1/summary?days=30&provider=all&model=allGET/POST /dsh-usage/api/v1/pricing(POSTaccepts{ "reset": true }to restore defaults)GET /dsh-usage/api/v1/export?days=30POST /dsh-usage/api/v1/backfillto rescan history
Note from source materials: Like other DSH local interfaces, these APIs do not perform login authentication. POST requests only validate same-origin. Do not expose the GUI port to the public internet or local network.
Installation and Activation¶
The installation command follows the repository README (the plugin directory must be placed locally first, then mounted using link:):
dsh plugin --profile desktop add link:/path/to/dsh-usage-insights
Then, open “Plugin Market → Installed” in DSH, enable dsh-usage-insights, and refresh the page. “Usage Insights” will appear in the settings sidebar.
To avoid restarting the GUI, hot-mounting can be used (replace <port> with the current DSH GUI port):
curl -X POST http://127.0.0.1:<port>/dsh-market/toggle \
-H 'content-type: application/json' \
-d '{"name":"dsh-usage-insights","enabled":true}'
License: MIT (see repository and package.json).
Typical Usage¶
After installation and activation as described above, follow these steps suggested by the README:
- Open Settings → Usage Insights.
- Select the time dimension at the top, and select the interface and model in the second row.
- View summaries using the three cards; switch between bar charts for “Cost / Tokens / API Requests.”
- Check request counts, tokens, and daily curves for each model in the “By Model” area.
- Open “Price Settings” to change unit prices if needed, or use “Export” to download CSV. The ⟳ icon in the top right allows immediate history rescanning.
Billing logic (from source materials): Cost = Cache Hit Tokens × Hit Price + (Missed Input + Cache Write) × Input Price + Output Tokens × Output Price. Built-in price examples:
| Model | Cache Hit | Missed Input | Output |
|---|---|---|---|
| DeepSeek Flash | 0.02 | 1 | 4 |
| DeepSeek Pro | 0.15 | 4.5 | 13.5 |
(Unit: RMB / million tokens.)
Local data files also include storages/dsh-usage-insights/pricing.json (custom unit prices) and backfill.json (backfill cursor).
Use Cases and Notes¶
Who is it for
- Users who frequently mix official accounts with multiple third-party endpoints in DSH and need a unified view of usage and rough billing estimates.
- Users who want to backfill history from existing
sessionslogs once and maintain the ledger incrementally thereafter.
Precautions
- The plugin runs with the permissions of the current DSH process. Review the GitHub source code and MIT license before installation.
- Community plugin directories (such as the SkillHub entry) are independent sites and have no official affiliation with DeepSeek / High-Flyer. The DSH ecosystem emphasizes “everything is a plugin”; this plugin is a community contribution, not a built-in feature.
- Session logs are multi-frame zstd files; the parser skips corrupted frames without interrupting the overall backfill process (see README for compatibility notes).
Conclusion¶
dsh-usage-insights consolidates scattered model calls within DSH into a local-only ledger, providing viewing, pricing adjustment, and export capabilities in the settings that resemble the official usage page. For installation instructions and API details, refer to the repository README:
- Directory Page: https://www.skillhub.cn/plugins/Ayowait/dsh-usage-insights
- Source Code & Documentation: https://github.com/Ayowait/dsh-usage-insights