Preface¶
DeepSeek Harness (DSH) adopts a plugin-based architecture, emphasizing modularity and extensibility. In development and usage scenarios involving multi-model or multi-account switching, real-time awareness of the current API balance or quota usage is key to improving efficiency. dsh-quota-cards is designed to address this pain point by providing a persistent quota card on the left side of the message input box, allowing users to view the current model’s quota status without leaving the chat interface.
Introduction¶
dsh-quota-cards is a DSH quota query plugin. It displays a persistent quota card on the left side of the composer (conversation.input.left). The card automatically follows the currently selected model and displays the corresponding account’s quota or traffic usage. The plugin supports manual refresh (with debounce) and periodic automatic refresh.
Core Features¶
- Persistent Quota Card: Located on the left side of the composer (
conversation.input.leftslot). - DeepSeek Balance Display: Shows the account balance, including the total and grant/top-up details (displayed via a Tooltip).
- OpenCode Go Usage Display: Shows the remaining token usage percentage for 5-hour (rolling) / weekly / monthly windows.
- Model Switching Support: Resolves the current model in real time via the
session.modelsRPC. IDs containingdeepseekdisplay the balance card,opencodedisplays the usage card, and other models display a placeholder. - Manual Refresh: Click to refresh immediately and bypass the cache. A 2-second cooldown mechanism is included; clicks are ignored during cooldown or while a request is in progress.
- Automatic Refresh: Supports intervals of 1/5/10/30/60 minutes, rescheduling the next refresh after each fetch.
Installation and Enablement¶
The plugin depends on DSH being installed and running (dsh web) and on pnpm being available in the system PATH.
- Extract the plugin to a local directory, for example
D:/plugins/dsh-quota-cards. - Run the install command to add the plugin to the Web configuration profile:
dsh plugin --profile web add file:D:/plugins/dsh-quota-cards
- Restart
dsh web. - Open Settings, go to the Quota Query page, confirm the credential references (defaults are
DEEPSEEK_API_KEYandOPENCODE_GO_API_KEY), and verify that the keys exist. - Return to the chat page; the quota card will appear on the left side of the composer.
Typical Usage¶
- Restart
dsh web. - Configure API keys in Settings.
- Switch models in the chat interface (for example, from DeepSeek to OpenCode Go) and observe the automatic changes in the left-side card content.
Notes¶
- Dependencies: The host-side service depends on
settings,credentials,sessions, andagentDefaultModel, with optionalwebServer; the client-side service depends onslotsandconnection, including the slotsconversation.input.leftandsettings.section. - Provider Matching: Matching is done by ID. When the DeepSeek official ID is
deepseek-official, the balance card is displayed; when the common OpenCode Go ID isopencode-go, the usage card is displayed. - Security: API keys are resolved on the host side via
ctx.credentials.resolve(); the browser only receives read-only query results. Updating settings requires a same-origin POST request. - Runtime Dependencies: There are no third-party runtime dependencies; its
peerDependenciesincludeschemasteryand the@deepseek-aipackage series.
Conclusion¶
This plugin simplifies quota management for DSH users through a persistent UI and automatic refresh mechanisms. For developers who frequently switch models or manage multiple accounts, it is a practical tool.