Introduction¶
When integrating multiple model sources in DeepSeek Harness (DSH), a common practice is to manually switch providers or modify the configuration after a routing failure. Once a request lands on a route with exhausted quota or a transient failure, both the agent loop and the session layer often need to handle the switching logic. dsh-llm-auto is a DSH host plugin that registers the auto model in the model selector, attempting requests sequentially along a configured, ordered chain of “provider + model”. If a failure occurs within a single route before any content is generated, it first retries in-place using a strategy similar to the official one. Once retries are exhausted, it silently switches to the next route, presenting itself to the upper layers as a single, ordinary model. The following section describes its positioning, capabilities, and installation/configuration methods.
What is this¶
- Name:
dsh-llm-auto(npm package name, registered ID isllm-auto) - Maintainer: liuyun847
- Category: Model Inference (classified in the community directory SkillHub)
- Repository: github.com/liuyun847/dsh-llm-auto
- Current Version (README badge): 0.11.1
- License: MIT
This package is a bundle: the registration lines are released within the package’s cordis.patch.yml. The host loads it via dsh.profile.bundles in the profile’s package.json, eliminating the need to manually paste - insert: lines into the profile’s cordis.patch.yml.
Core Functionality¶
Ordered Fallback and In-Route Retry¶
When a user selects auto under the Auto group, the request enters AutoAdapter.stream(). The plugin attempts routes in the order defined by routes. If a hop fails before producing any content, and the error code is in the retryable whitelist (defaulting to EMPTY_RESPONSE, RATE_LIMIT, SERVER, TIMEOUT, TRANSPORT), it retries in-place with exponential backoff (within that route, defaulting to a maximum of 5 retries per route, excluding the first attempt). It only switches to the next route when retries are exhausted. Upon success, chunks are passed through as-is. If all routes fail, an AUTO_ROUTES_EXHAUSTED error is thrown, with a message listing the attempt count and failure reason for each route.
Each route is configurable:
keepThinking: Preserves thinking blocks during tool loops on DeepSeek native routes (removed by default).breakToolLoop: Appends a user prompt when specific history patterns occur, ensuring the outbound message ends with a user message to bypass tool-loop validation in thinking mode.
When a silent route switch occurs, a “model changed” notification (identical to DSH’s built-in one) is appended to the end of the outbound message (modifying only the outbound payload, not the session history).
Reasoning Tiers (Since 0.10.0)¶
The model selector offers two tiers for auto: Default (the plugin does not write a tier, letting the host/upstream default decide) and max (takes the highest tier available for that route on a hop-by-hop basis, corresponding to the old behavior in 0.9.x).
Quota-Aware Ordering and Cooldown (Since 0.8.0, Enhanced in 0.11.x)¶
By default, ordering.mode is auto: the plugin determines the attempt order based on subscription quotas. Subscriptions with monthly reset times are ordered by “earliest reset first,” those without a known reset time follow the configured order, and non-expiring quotas are placed last as a fallback. If a hop is rejected due to window quota exhaustion (error code QUOTA or a message matching window quota semantics; the criteria were broadened in 0.9.1 to cover text like Command Code), the plugin queries the quota API. Upon confirmation, it cools down that source until the corresponding tier’s reset time, skipping attempts during this period and automatically recovering at the set time.
Since 0.11.0, the cooldown table is persisted (in the host domain storage), surviving DSH restarts and plugin re-bundling until the reset time. When a QUOTA rejection occurs, it first records a 5-minute short gate; after the confirmation query, this is replaced by the reset time. The panel provides a “Release” button to the right of the cooldown row (for use when the quota recovers early). Since 0.11.1, consumed records of “Release” commands are also persisted to prevent duplicate consumption of old commands after a host restart.
To revert to the “strictly follow routes order, switch only on failure” behavior, set ordering.mode to manual (a toggle exists on the plugin page, and hot-changes take effect immediately).
compactWindow and Compaction Point¶
You can pin the automatic compaction point near a specific size by setting compactWindow (default 500000 tokens). The DSH compaction engine calculates the threshold based on the “window declared for that request.” The window declared by this plugin to the outside is back-calculated from the compaction point.
Plugin Page and Observability¶
Since version 0.4.0, it includes a browser-based sidebar: Navigate to “Plugins” → “Installed” in the Web sidebar and click the dsh-llm-auto card to directly modify form items like compactWindow.
Fallback Chain Panel (Read-only in 0.5.0, editable in 0.6.0): Reorder routes via drag-and-drop, switch models from the live model catalog, toggle keepThinking/breakToolLoop by row. Saving writes to the profile’s cordis.patch.yml and takes effect without a restart. The lower half displays the actual fallback process of recent requests.
Since 0.7.0, there is a read-only “Quota” summary; since 0.8.0, an “Auto-Ordering” summary (mode toggle + actual attempt order, cooldown entries show recovery time). Since 0.9.0, the interface is consolidated by auto/manual modes: the main view in auto mode shows the “Effective Order,” while the editable chain is collapsed into a default-collapsed “Configured Order.”
For debugging, access http://127.0.0.1:19387/api/llm-auto/routes to view the actual routes taken and the currently declared context window. Since 0.6.0, GET /api/llm-auto/catalog is available for model selection in the chain editor.
Installation and Activation¶
Operate in the DSH profile directory (example: ~\.dsh\profiles\desktop\).
# ① Install into the profile: dshpm will also write the package name into dsh.profile.bundles
node <workspace>\dsh\dsh-plugin-manager\dshpm.mjs add file:./plugins/dsh-llm-auto --profile desktop
# Public environment: Add "dsh-llm-auto": "github:liuyun847/dsh-llm-auto" to the profile's package.json
# Then run pnpm install (or npm install) — similarly, only requires the package name in dsh.profile.bundles
# ② Modify routes according to local providers: Edit the line in the package's cordis.patch.yml (can also be overridden by ID at the profile layer)
# ③ Restart DSH once (Local desktop client: Close and reopen the DeepSeek Harness window)
Note: The browser sidebar added in 0.4.0 requires a DSH restart to be registered; during HMR-only updates, the plugin page might temporarily fail to show the configuration form.
Start/Stop: The master toggle for this card in the “Installed” section of the “Plugins” page in the Web sidebar (writes to dsh.profile.bundles). Individual rows within the card also have row-level toggles (writing a disabled override to the profile’s cordis.patch.yml).
Uninstall:
node dshpm.mjs remove dsh-llm-auto --profile desktop
If the profile’s pnpm supply chain policy causes pnpm remove to error, you can execute the following in the profile directory:
pnpm remove dsh-llm-auto --config.minimum-release-age=0
Configuration Essentials¶
There are two entry points for configuration: the plugin page form (compactWindow, routes, ordering.mode, etc., for hot changes) and the package/profile-overridden cordis.patch.yml (structural items like retry can only be changed via patch).
Example package registration (excerpt from README, adjust according to local providers):
- insert:
- id: llm-auto
name: 'dsh-llm-auto'
config:
routes:
- { provider: commandcode, model: deepseek/deepseek-v4.1-flash }
- { provider: opencode-go, model: deepseek-v4.1-flash }
- { provider: deepseek-official, model: deepseek-flash, keepThinking: true, breakToolLoop: true }
compactWindow: 500000
# ordering.mode defaults to auto; see above for manual
# If retry is not specified, default is 5 retries per route
| Key | Default | Hot Change | Description |
|---|---|---|---|
routes |
— | ✅ | Ordered fallback chain; the first item is the preferred route. model must use the real ID declared by the provider. |
compactWindow |
500000 |
✅ | The approximate token size where automatic compaction occurs. |
ordering.mode |
auto |
✅ | auto: Quota-aware ordering + cooldown; manual: Strictly follow configured order + switch on failure. |
retry.* |
See README | ✗ | Retry limit, whitelist, and backoff parameters per route. |
Fields marked as “Hot Change” are updated in-place after being written via the host settings service. Changing chains, modes, or compaction points generally does not require a restart. Structural configurations like retry require changing the patch and rely on the apply boundary (see README “Effective Conditions”).
Typical Usage¶
- Install and restart DSH as described above. Configure a list of locally available
provider+modelcombinations in the package or via the “Fallback Chain” on the plugin page. - In the model selector, choose
Auto→auto(optionally select Default or max reasoning tiers). - Converse normally; to confirm the actual route, open
http://127.0.0.1:19387/api/llm-auto/routes. - If multiple subscriptions coexist and you want to prioritize “fast-reset” quotas, keep
ordering.mode: auto. Check the “Effective Order” and cooldown rows on the plugin page. If you only want a fixed priority, switch tomanual. - If you want long contexts to trigger compaction near a specific token count, adjust
compactWindowon the plugin page.
Use Cases and Notes¶
Suitable for: Developers who have configured multiple DSH providers and want to merge them into a single model entry point; who need automatic retries or routing switches in cases of QUOTA, 502, rate limiting, etc., without modifying agent or session layer code.
Notes:
- The plugin runs with the permissions of the current DSH process. Please review the source code and MIT License before installing.
- The community directory SkillHub is an independent site and has no official affiliation with DeepSeek or 幻方 (High-Flyer). The DSH ecosystem advocates “Everything is a plugin.” For factual information regarding this plugin, the repository README is the source of truth.
- Do not write YAML values like
ordering.modein!!js, functions, or non-plain object formats, otherwise it may cause the entire plugin line to fail loading (explained in the README).
Conclusion¶
dsh-llm-auto collapses multiple “provider + model” combinations into a single auto in the model selector. Using ordered fallback, in-route retries, and optional quota-aware ordering, it reduces the hassle of manually switching models and repeatedly hitting quota limits. For further information and installation instructions, see the community directory page and GitHub repository:
- Directory Page: https://www.skillhub.cn/plugins/liuyun847/dsh-llm-auto
- GitHub: https://github.com/liuyun847/dsh-llm-auto