Introduction¶
The design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” In local development and debugging, accurately tracking token consumption is key to assessing costs and optimizing model calls. Existing DSH session records are usually only valid while the current process is running and are lost after a restart. The dsh-token-usage-sidebar plugin solves this problem. It retrieves usage records from DSH provider runtimes, persistently stores the data in a local SQLite database, and provides both a sidebar summary and a native settings page for viewing.
Core Features¶
This plugin provides the following specific features:
- Sidebar Summary: Displays today’s, yesterday’s, and lifetime total token usage in the DSH interface sidebar.
- Native Settings Page: Provides a “Token Usage” page in the DSH settings menu, supporting detailed metric display.
- Detailed Metric Cards: Supports Compact mode to display Total, Input, Output, Cache, Reasoning, and Calls.
- Time Range Selection: Supports selecting Today, Yesterday, 7D, and All time.
- Dynamic Filtering: Provider and model lists are extracted directly from actual DSH data, without relying on hardcoded preset lists.
- Local Persistence: Uses SQLite journaling for storage, supports WAL logging, and ensures stable write latency.
- Shutdown Safety: Flushes unsaved data before DSH shuts down to prevent accidental loss.
- Historical Recovery and Deduplication: Recovers historical data from DSH session records and performs deduplication, ensuring each call is counted only once.
Installation and Activation¶
Install it into the web profile via the DSH CLI:
dsh plugin --profile web add @y2zyyr/dsh-token-usage-sidebar
After installation, you need to restart the dsh web service to load the plugin.
Usage¶
- View Statistics: You can see an overview of today’s, yesterday’s, and total usage in the left sidebar of the DSH interface.
- View Details: Go to the DSH settings menu and open the “Token Usage” page to view more detailed metric cards.
- Filter Data: On the details page, select a time range (such as 7D), and the metric cards and table below will dynamically filter the corresponding providers and models based on the actual data within that range.
Notes¶
- This is a community plugin, not an official DeepSeek plugin.
- The plugin uses data reported by the provider/runtime for statistics, rather than estimation based on tokenizers.
- Uninstalling the plugin will not clear the locally persisted SQLite accounting data.
- Historical reports are transparent, explicitly showing source scan status and historical coverage.
Summary¶
This plugin provides stable local statistics through SQLite journaling, making it suitable for developers who need to track token consumption over the long term. For more details, please refer to the project homepage or GitHub repository.