Preface¶
In the usage scenarios of DeepSeek Harness (DSH), official models typically incur higher inference costs during peak periods. The dsh-peak-avoidance plugin is designed to address this issue: it can automatically switch to a specified alternative model before peak periods begin and switch back to the official model after peak periods end, thereby avoiding peak-hour pricing.
Plugin Introduction¶
This plugin is a model inference tool maintained by Youmu Xiashi. It uses automated model routing to help users use more economical models during off-peak periods and switch smoothly at specific time points.
Core Features¶
- Scheduled Switchover: Automatically enters peak-avoidance mode before the window starts (default: 30 minutes) and restores automatically when the window ends.
- Dual Routing Support: Supports both
agentDefaultModel(default routing) andapiProxy.sessions.selectModel(real-time sessions, taking effect in the next turn). - Multiple Time Window Support: Supports configuring multiple time windows and supports windows that cross midnight (for example,
22:00-02:00). - Reasoning Level Support: A reasoning level (such as
high) can be set for each model; dropdown menu data is fetched from the real-time model catalog. - Dynamic Retrieval: Data such as model lists and provider lists is fetched in real time from DSH’s
llmservice, eliminating the need for hard-coding. - Switchover Notifications: A toggleable banner notification is displayed when entering or exiting peak-avoidance mode (enabled by default and can be disabled).
- Manual Control: Provides control via card buttons and the
peak_avoidance_status/peak_avoidance_controlmodel tools. - Safe Restoration Mechanism: The
restoreOnStopmechanism ensures that the original model settings are restored when DSH stops.
Installation and Enablement¶
It is recommended to install via npm:
npm install dsh-peak-avoidance
After installation, you need to modify DSH’s configuration file $DSH_HOME/cordis.patch.yml by adding the following content:
- insert:
- id: peak-avoidance
name: 'dsh-peak-avoidance'
Restart DSH after the changes are completed.
Typical Usage¶
- Configure Models: Locate the
peak-avoidancesection in DSH’ssettings.yamland configurepeakModel(peak-avoidance model) andnormalModel(official model). - View Status: View the status and configuration in the settings interface under the “Plugins” → “Configurable” → “Peak Avoidance” card.
- Manual Intervention: Manually enter or exit peak-avoidance mode via the buttons on the card; or use the model tool
peak_avoidance_statusin the conversation to view the current status andpeak_avoidance_controlto control it.
Notes¶
- Author’s Statement: The author states they have no programming experience, and the code has not undergone professional review. The installation instructions may contain AI hallucinations (inaccurate or fabricated steps). Please be sure to test the security, stability, and correctness of the plugin yourself.
- Privacy and Security: The plugin does not read, store, or send any API keys; the client bridge only accepts loopback requests.
- No Build Step: This plugin does not require a build process and uses
lib/index.jsandlib/client.jsdirectly.