Preface¶
DSH’s plugin system allows extending the harness’s model selection, settings cards, and request routing capabilities. dsh-model-router is a community plugin designed to solve a specific scenario: users have configured multiple providers and multiple models, and wish to see all models unified in the model selector, and send the request to the currently active provider for that model every time an LLM request is made.
Instead of saving the real provider in the session, it forces the session to always use the virtual provider model-router. When a request is sent, it resolves the currently active provider and delegates it to the original adapter pipeline. Below is an introduction to its capabilities, installation methods, and configuration options.
What is this¶
dsh-model-router is maintained by fonlan with an MIT license.
It registers a virtual model provider with the DSH harness:
model-router
This provider aggregates all providers and their models added by the user, strictly merging them by model id. Every time an LLM request is made, the plugin routes the request to the currently active provider for that model.
The settings entry is located at:
Settings → Plugins → Plugin Configuration → Model Routing
Core Capabilities¶
Virtual model-router Provider¶
After installation, model-router appears in the model selector below the input box, as well as in other model selection entry points like default model settings.
It lists all models from all configured providers. Model entries are labeled with the currently active provider, for example:
via OpenCode Go
This means users don’t see models scattered across different providers, but rather a unified model entry point.
Provider Switching in Model Selection Menu¶
When the current session selects a model-router model, clicking the model selector in the input bar reveals a three-column menu: “Model / Provider / Reasoning Tier”.
The “Provider” column lists the currently active provider for that model and supports direct switching. Switching it means subsequent requests for that model will use the new active provider.
The visibility of this entry is controlled by showQuickSwitch. When there is only one provider globally for the router, or when the current model is served by only one provider, the provider column is automatically hidden.
Strict Merging by Model ID¶
If the same model appears in multiple providers, it is merged into a single model entry.
Display name, context window, reasoning tier, and other parameters follow the currently active provider. When requesting, the plugin sends the request to the real provider using the original model ID of that provider.
Ignoring Model ID Prefix on Match¶
The plugin supports ignoring model ID prefixes during matching, which is enabled by default but can be turned off in settings.
For example, in the configuration example:
deepseek/deepseek-v4-flash
and:
deepseek-v4-flash
can be treated as the same model, uniformly displaying the model ID without the prefix. Passing an ID with a prefix during a request will also hit the same route.
This is just a configuration example and does not imply that these models are necessarily available.
Real-time Routing on Request¶
The session always saves:
provider=model-router
Every time an LLM request is sent, the plugin resolves the currently active provider within the process and delegates it to the real adapter pipeline for processing.
This approach uses the same routing logic for the main agent, sub-agents, and tool LLM calls.
Settings Card¶
The settings card is located at:
Settings → Plugins → Plugin Configuration → Model Routing
In the settings card, all providers under each model are listed, and the following operations are supported:
- Click a provider to switch the currently used provider.
- Drag providers to adjust priority order.
- Providers without an API key configured are not selectable and appear grayed out.
order and active are maintained separately:
- Clicking to switch only changes
active. - Dragging to reorder only changes
order.
order is used to maintain the priority order, reserved for future automatic switching strategies; the current version returns an error directly when a request fails without automatic switching.
Model Display Order¶
The model-router group in the model selection list supports three display orders:
custom | name | recent
The meanings are as follows:
custom: Custom order, you can manually drag to reorder models.name: Sort by name.recent: Sort by recent usage; models requested recently are placed at the front, unused ones at the end.
After switching the display order or dragging model order, it takes effect globally immediately.
Auto-sync Configuration¶
After adding or removing providers/models, the plugin automatically syncs the configuration:
- Disappearing providers are cleaned up from the sort order.
- When the active provider becomes invalid, it automatically falls back to the first remaining one.
- New providers are appended to the end of the sort order.
- Disappearing models are cleaned up from the custom order.
- New models are appended to the end of the custom order.
- Unconfigured models are automatically selected as the first in the sort order.
modelOrder and recentlyUsed are automatically maintained by the plugin; no manual writing is required.
CLI and Headless Profile¶
The plugin is not just for web profile. After installation in CLI / headless profile, it also routes according to the configuration.
In such scenarios, you can directly manually edit the model-router section in settings.yaml.
Installation and Enablement¶
Install from npm package¶
Use the official installation command:
dsh plugin --profile web add @fonlan/dsh-model-router
Local Source Code Installation¶
You can also install by building from the local repository. After building the lib/ artifact in the repository directory, add it as a local directory:
pnpm build
dsh plugin --profile web add .
Mounting and Effectiveness¶
After installation, the plugin is automatically mounted to the target profile via cordis.patch.yml:
- Server-side registration of
model-routerprovider and routing configuration. - Web-side registration of
settings.plugin.itemsettings card. - Takes effect after restarting the profile.
After restarting the web profile, a Model Router group will appear in the model selector below the input box.
Note: The plugin runs with the permissions of the current DSH process. You should check the source code and license before installing. The license for this plugin is MIT.
Configuration Example¶
Routing configuration is persisted in the model-router namespace of the settings document. A configuration example is provided below; the model IDs within are for illustration only and do not represent model availability.
model-router:
showQuickSwitch: true
ignoreModelIdPrefix: true
modelSort: custom
modelOrder:
- deepseek-v4-flash
- qwen3.7-max
recentlyUsed:
deepseek-v4-flash: 1787036509332
models:
deepseek-v4-flash:
order:
- opencode-go
- deepseek-official
active: opencode-go
The meanings of each configuration item are as follows:
showQuickSwitch
Controls whether to show the provider switching entry in the model selection menu; enabled by default.
ignoreModelIdPrefix
Controls whether to ignore the model ID prefix when matching; enabled by default.
modelSort
Controls the model display order, options are:
custom | name | recent
The default value is:
custom
modelOrder
Used for the model display order in custom mode, maintained automatically by the plugin.
recentlyUsed
Used for recent mode, recording the model ID and the last used timestamp, maintained automatically by the plugin.
models.<model>.active
The currently actually used provider.
models.<model>.order
Provider priority order, used for future automatic switching strategies.
Typical Usage¶
Web profile¶
- Install the plugin and restart the profile.
dsh plugin --profile web add @fonlan/dsh-model-router
- Open:
Settings → Plugins → Plugin Configuration → Model Routing
-
Click a provider under a model to switch the currently used provider.
-
If you need to adjust priority, you can drag to reorder providers.
-
Return to the model selector below the input box and select a model from
model-router. When initiating a request, it will be routed to the currently active provider.
CLI / headless profile¶
-
Install the plugin to the target profile.
-
Restart the profile.
-
Modify the
model-routersection insettings.yaml, for example adjusting:
models.<model>.active
models.<model>.order
modelSort
showQuickSwitch
ignoreModelIdPrefix
- Route according to the configuration after restarting.
Applicable Scenarios and Notes¶
Suitable for the following DSH users:
- Already configured multiple providers.
- The same model may come from multiple providers.
- Wish to view models in a unified model selector.
- Wish to manually switch the provider currently used by a specific model.
- Wish to manually maintain provider priority order.
- Need to use the same routing configuration in web, CLI, or headless profiles.
Please note the following points:
- When the current provider request fails, the plugin returns an error directly; automatic switching is a planned future feature.
orderandactiveare maintained separately; clicking to switch does not change the priority order derived from dragging.- Providers without an API key configured are not selectable in the settings card.
- The model IDs in the configuration example are just examples and do not indicate that these models are available.
- The plugin runs with the permissions of the current DSH process; check the source code and license before installing.
- The DSH community directory is an independent site with no official affiliation with DeepSeek / Huafan, and should not be regarded as an official app store.
Conclusion¶
The value of dsh-model-router is to converge the model entry points of multiple providers under the single virtual provider model-router, and resolve the currently active provider every time a request is sent. It is suitable for DSH users who need to manage multiple provider model entry points uniformly, manually switch the current provider, and maintain priorities.
Directory page: No verified URL provided.
GitHub:
https://github.com/fonlan/dsh-model-router