In DSH use cases, you may need to block specific models or provider routes without modifying underlying provider configurations or credentials. dsh-model-gate provides a non-destructive overlay to meet this need.

Core Functionality

The plugin intercepts DSH’s discovery path and removes disabled models from all visible lists. It also ensures that any scheduling request attempting to invoke these models returns a MODEL_DISABLED error at the protocol level, blocking subsequent network requests. It is maintained by OPaimon and licensed under the MIT License.

Installation and Enabling

Add the plugin using the official installation command:

dsh plugin --profile web add dsh-model-gate

Alternatively, if you downloaded a tarball package from a Release, you can extract it first and then install:

tar -xzf dsh-model-gate-0.1.2.tgz    # 解压得到 ./package/
dsh plugin --profile web add ./package

After installation, restart DSH once to activate the new plugin layer. Subsequent edits to the blacklist are hot-applied through the settings page without requiring another restart.

Configuration and Usage

Edit the configuration file ~/.dsh/settings.yaml and define disabledProviders and disabledModels under the llm-model-gate node. Changes take effect immediately.

llm-model-gate:
  disabledProviders:
    - openrouter
  disabledModels:
    - "*/kimi-k2.7-code"        # 禁用所有提供者上的该模型 ID
    - "token-rhythm/glm-5"      # 禁用特定 provider/model 对

Matching rules are exact and case-sensitive. Using the */model prefix in disabledModels matches the model route across all providers.

Discovery and Scheduling Behavior

  • Discovery path: Disabled models completely disappear from the Web selector, catalog lists, and API request validation, as if they were never configured.
  • Scheduling interception: Any path that still attempts to schedule a disabled model (for example sub-agents, session titles, custom routes, or explicit IDs) is stopped in the llm/stream water flow. At this point, a finish{kind:"error", code:"MODEL_DISABLED"} error block is returned, and no network request is initiated.

Interface and Limitations

The DSH Web settings panel provides a “Model Gate” section. This section reads the unfiltered catalog through the plugin’s own typert service, so you can view all models and their on/off states, and re-enable disabled models.

  • Non-destructive: The plugin does not touch any provider configuration files or credentials. Providers remain installed; only their public lists are filtered.
  • Route distinction: Vision route clones (such as openrouter-vision) are independent route keys and must be blocked separately.
  • Uninstall residue: After uninstalling the plugin, any leftover llm-model-gate configuration block is harmless and does not affect system operation.

The plugin has been validated against DSH 0.1.x-rc versions.

Plugin repository: GitHub - OPaimon/dsh-model-gate