Preface¶
When developing with DSH, the model invocation itself is usually not the hardest part—the challenge comes after the call is made: quickly verifying which call came from which session, which model was used, the status code, the token bucket counts, the estimated cost, and where the error message is when a call fails.
Below is an introduction to a plugin: @wycto/dsh-token-usage. It records all LLM API calls (model requests) in DeepSeek Harness and provides a single-window, full-screen statistics panel. This article refers to the plugin by its npm package name @wycto/dsh-token-usage; the repository and README use the name dsh-token-usage.
What This Is¶
@wycto/dsh-token-usage is a DSH plugin that organizes model call records in DSH into a queryable statistics panel.
Basic information verified from available sources:
- Maintainer:
wycto - npm package name:
@wycto/dsh-token-usage package.jsonversion:0.1.14- License:
MIT peerDependencies:@deepseek-ai/dsh *- Source repository:
https://github.com/wycto/dsh-token-usage
Its purpose is not to re-intercept model requests or replace DSH’s call chain, but to read DSH session logs and organize existing call information into capabilities for statistics, filtering, sorting, and exporting.
Core Features¶
Entry Point and Full-Screen Panel¶
After installation and enabling, a blue gradient button labeled “Token Usage” appears at the bottom of the DSH sidebar. Clicking it opens the full-screen statistics panel.
Query and Filtering¶
The panel supports querying call records by conditions:
- Start and end times use
datetime-local, accurate to the second. - By default, no time limit is applied, and all records are displayed.
- Filter conditions are temporarily stored in
localStorageand restored the next time the panel opens. - Clicking 【Reset】 clears all conditions.
- Provider/Model dropdowns merge existing configurations and historical records with deduplication.
- Supports filtering by Session ID / Model Provider / Model / Status / Reasoning Effort dropdowns.
Detail Table and Sorting¶
The detail table provides a record of each call. The README states that all 15 columns in the detail table support sorting by clicking the header. The sort dimensions include:
- Time
- Session ID
- Provider
- Model
- Input
- Cache
- Hit %
- Output
- Reasoning
- Total
- Cost
- Cost (¥)
- Effort
- Status
- Duration
By default, records are sorted by time in descending order, with the latest records appearing first.
Session ID Quick Filtering¶
The detail table displays session IDs. Clicking any session ID filters subsequent records by that session.
Status Codes and Detail Modal¶
The status column displays the call status. For calls with status codes, HTTP status codes such as 200, 400, 401, 429, 500, etc., can be displayed.
Below the status, a detail modal can be opened to view more complete call information, including:
- Session ID
- Error message
- Error code
- Token buckets
- Cost
- Duration
- Turn / Step related information
Grouped Statistics¶
The panel supports grouping statistics by the following dimensions:
providermodelstatuseffort
Grouped statistics items include call count, tokens, hit rate, cost, duration, etc.
CSV Export¶
Supports exporting full-field CSV details based on the current filter conditions for further local processing.
Cost Display¶
Costs are displayed in dual currencies:
- USD
- CNY
The README explains that costs are based on official CNY pricing and exchange rate conversion, with a default exchange rate of 7.2, which can be overridden via token-usage.usdCnyRate in settings.yaml.
This plugin supports DeepSeek-V4 peak and off-peak tiers. Costs are estimates and are not exact billing amounts.
Installation and Enabling¶
npm Package Installation¶
The installation command verified from available sources is:
dsh plugin --profile <profile name> add @wycto/dsh-token-usage
After executing this command, the plugin is installed to the specified profile.
Restart DSH¶
DSH needs to be restarted after installation:
dsh --profile <profile name>
Opening the Panel¶
After the restart, click the blue “Token Usage” button at the bottom of the DSH sidebar to open the full-screen statistics panel.
Typical Use Cases¶
Querying by Time Range¶
After opening the panel, you can use the start/end datetime-local fields, accurate to the second, to filter call records.
For example, view only calls within a specific time period on a certain day. If you no longer want to keep the filter conditions, click 【Reset】 to clear all conditions and return to displaying all records.
Querying by Session ID¶
When you see a session ID in the detail table, simply click that session ID to filter by that session.
This is useful for troubleshooting multiple model calls within a complete session.
Sorting by Column Headers¶
Click any column header in the detail table to toggle between ascending and descending order.
By default, records are sorted by time in descending order. You can also reorder by model, status, cost, duration, etc., to quickly identify records with higher consumption or more failures.
Local Development Experience¶
During local development, you can integrate the plugin files into the DSH web build as shown in the README example.
First, prepare the files:
- Place
lib/index.jsandclient/index.jsintosrc/. - Insert the plugin line in
cordis.patch.yml. In the README example, thename/iduses the scoped package name@wycto/dsh-token-usage. - Execute the build command:
pnpm dsh web --patch ./dsh-token-usage/cordis.patch.yml
Configuring Exchange Rate and Pricing¶
You can configure the exchange rate, pricing page, automatic fetch interval, and manual price overrides under the token-usage section in settings.yaml.
The verified configuration items include:
token-usage:
usdCnyRate: 7.2
pricingUrl: ''
pricingFetchIntervalHours: 24
pricing: {}
Where:
usdCnyRate: The exchange rate between USD and CNY, with a default value of7.2in the README example.pricingUrl: The pricing page URL.pricingFetchIntervalHours: The interval for automatically fetching pricing, in hours, with a default value of24in the README example.pricing: Manually override or add price entries. The README example supports configuration by model and supports DeepSeek-V4’speakpeak/off-peak periods.
After modifying settings.yaml, restart or reload according to DSH’s actual loading mechanism for changes to take effect.
Data Sources and Limitations¶
Data Sources¶
This plugin only reads DSH session logs and does not interfere with the model call chain.
The README explains that it extracts information about each model call from DSH session events and organizes it into fields such as details, status, tokens, cost, and duration in the panel.
Costs Are Estimates¶
Costs are displayed as estimates. The plugin includes a table of common model unit prices, and unknown models use a fallback unit price.
If official prices change, the README states the plugin automatically fetches the latest pricing from the official website daily; if fetching fails, it falls back to built-in defaults. You can also manually override via settings.yaml.
Failed Calls May Not Have Token Records¶
Failed calls, especially those without an assistant/message, may not generate token records.
In such cases, the status column reflects the turn outcome, which is used to determine whether the call ultimately completed, errored, was aborted, etc.
Token Display Under OCX Gateway¶
When the local machine is an OCX gateway, the usage field may be missing. In such cases, token counts may display as 0.
Record Reconstruction¶
Records in the plugin are an in-memory index. After a process restart, they are rebuilt from DSH session logs.
API Key Display¶
apikey is never displayed in plaintext; only a masked version is shown. The plugin does not copy keys.
Suitable Scenarios and Considerations¶
Suitable for the following scenarios:
- Need to view detailed model call records for a specific session in DSH.
- Need to observe call distribution grouped by model, provider, status, or reasoning effort.
- Need to troubleshoot status codes such as
400,401,429,500, and error messages. - Need to export CSV for local secondary analysis.
- Need to view estimated costs in both USD and CNY.
Before using, note:
- The plugin runs with the permissions of the current DSH process. Inspect the source code, license, and dependencies before installation.
- Costs are estimates and are not suitable as precise financial evidence.
- Failed calls may not have token records.
- Under the OCX gateway, some token fields may display as
0. - The plugin only reads DSH session logs and does not alter the model call chain.
Conclusion¶
The value of @wycto/dsh-token-usage lies in organizing the LLM API call information originally scattered across DSH session logs into a local statistics panel that is queryable, filterable, sortable, and exportable. It is suitable for viewing model consumption, troubleshooting call statuses, and performing local analysis by session or model dimension.
The verified sources do not include a documentation page URL; this article only provides the source repository address:
- GitHub:
https://github.com/wycto/dsh-token-usage