Introduction¶
DSH’s philosophy is “everything is a plugin”. Developers can connect common capabilities to the DSH session environment in the form of plugins. dsh-usage is a usage query plugin for DSH providers, used to query packages/balance usage of various LLM providers in real-time and display usage reading bars in the session interface. It is suitable for developers who need to use multiple provider APIs at the same time, such as Kimi, Zhipu, DeepSeek, Volcengine (Fangjian), etc.
Below is an introduction to its features, installation, configuration, and notes.
What is this¶
dsh-usage is maintained by heekei under the MIT license. It is a standard bundle-type plugin, declaring dsh.bundle.patch, and is automatically enabled after being installed to the DSH Web profile.
It mainly solves two problems:
- Centralize provider package/balance usage queries into DSH;
- Provide usage readings and configuration entry points in the session interface and settings page.
The README contains inconsistent descriptions regarding the position of the usage reading bar (“above the input box” / “below the input box”). This article does not use this as a fixed position description.
Core Features¶
Automatic Vendor Recognition¶
The plugin automatically recognizes Kimi / Zhipu / DeepSeek / Volcengine (Fangjian) based on the vendor base URL. When adding new vendors of the same type, usage queries can be enabled with zero configuration.
Custom Queries¶
For relay stations, self-built services, or special interfaces, you can configure:
urlmethodheadersbodyextractor
The query is compatible with access tokens and access keys/secrets. extractor is a local JavaScript expression (new Function), writable only for your own configuration.
Volcengine Fangjian AK/SK¶
Volcengine (Fangjian) supports Control Panel AccessKeyId / SecretAccessKey (Signature V4). accessKeyId / secretAccessKey are secret fields and are masked during cross-wire transmission.
Usage Gauge¶
The plugin displays a usage gauge with the following color grading:
- Remaining ≥ 50%: Green
- Remaining ≥ 20%: Orange
- Remaining < 20%: Red
Settings Page Configuration¶
The settings page provides a “Usage Query” section. You can configure Enable/Type/Display Name/Credential Reference/Custom API/AK·SK by provider. Changes take effect immediately upon saving (hot reload).
Data Interface and Refresh¶
The plugin provides a data interface:
GET /api/dsh-usage.json
This interface is on the same origin as DSH and does not require a separate port. Usage is refreshed automatically with a default refresh interval of 5 minutes.
Default Specifications¶
When there is no dsh-usage section, built-in default specifications are used (Kimi×2 / DeepSeek / GLM / Fangjian×2).
Installation and Activation¶
First, confirm that the DSH Web environment meets the plugin dependencies:
- peerDependencies:
@deepseek-ai/schemastery ^3.18.1,react ^18.2.0 - engines:
node >=18 - dsh.client.platform:
web
Use the GitHub address to install:
dsh plugin --profile web add github:heekei/dsh-usage
Or use the git address to install:
dsh plugin --profile web add git+https://github.com/heekei/dsh-usage.git
The plugin declares dsh.bundle.patch and is automatically enabled after installation. Restart DSH Web for changes to take effect after installation.
Typical Usage¶
Configuration in Settings Page¶
Enter:
设置 → 用量查询
Configure Enable/Type/Display Name/Credential Reference/Custom API/AK·SK by provider, and save to apply.
Configuration in settings.yaml¶
You can configure by provider name under dsh-usage.providers in settings.yaml, for example:
dsh-usage:
providers:
kimi-coding:
# Built-in Kimi query
ark-coding-mine:
# Volcengine Fangjian AK/SK
my-gateway:
# Custom API
glm-zk:
# Explicitly configure or disable
Only write credential references in the configuration; credentials are unified in:
~/.dsh/.credentials.yaml
Configure Refresh Interval¶
The refresh interval can be configured in the following locations:
- Settings → Usage Query → Usage Refresh Interval
dsh-usage.intervalinsettings.yaml- Environment variable
DSH_USAGE_INTERVAL_MS
The default refresh interval is 5 minutes.
Applicable Scenarios and Notes¶
Suitable for the following scenarios:
- Using multiple provider APIs in DSH Web;
- Wanting to view package/balance usage instead of frequently opening the provider backend;
- Need to include usage of custom gateways/self-built services in DSH display.
Notes before use:
- The plugin runs with the current dsh process permissions; check the source code and license before installing.
- License is MIT.
extractoris a local JavaScript expression (new Function), only use configurations you trust.accessKeyId/secretAccessKeyare secret fields and are masked during cross-wire transmission.- The README has inconsistent descriptions regarding the position of the usage reading bar (above/below); the actual position is based on the interface after installation.
Links¶
GitHub:
https://github.com/heekei/dsh-usage
Directory page link (Community Directory, not official app store):
https://www.skillhub.cn/plugins/heekei/dsh-usage