dsh-magpie-connect: Integrating Magpie Gateway Models into the DSH Model Selector

Introduction

DeepSeek Harness (DSH) session capabilities depend on the LLM you select at runtime. If the model runs behind a local Magpie gateway, the common practice is to maintain a separate model list, manually write the OpenAI-compatible address, or attach an extra proxy layer outside the harness. The plugin dsh-magpie-connect (maintainer bitxeno, repository bitxeno/dsh-magpie-connect) registers models on the Magpie gateway as native DSH LLM adapters: once installed, simply fill in the gateway address and Key in the Web settings, and the models will appear in the DSH model selector. There is no need to start a separate process for the gateway or configure a system proxy.

What is this

dsh-magpie-connect is a “Model Inference” category plugin in the DSH community plugin directory, described as: quickly connecting Magpie gateway models to DeepSeek Harness. It implements MagpieAdapter (LlmAdapter) within DSH, communicating with the gateway via OpenAI-compatible chat/completions or responses streams. The model catalog is fetched from the gateway endpoint GET {baseUrl}/models and cached locally; a static snapshot compiled into the code serves as a fallback when the gateway is unreachable.

State and settings are written to ~/.dsh-magpie-connect/ (including settings.json, model cache, and adapter-status.json). The plugin runs with the permissions of the current dsh process. It is recommended to review the source code and the MIT license on GitHub before installation.

Core Features

The following capabilities are derived from the plugin’s README and package.json descriptions:

  • Automatic Model Synchronization — Models listed by the gateway become available in the DSH model selector; specifically, which ones are displayed is determined by a whitelist (enabledModels), with semantics consistent with DSH’s native “Models” settings.
  • Image Recognition — Models declared by the gateway as supporting images can accept image input; text-only models will throw an error immediately upon receiving an image rather than silently discarding it.
  • Thinking Levels — Thinking levels supported by the gateway (including none, ultra) appear in the selector as-is; none disables thinking, and ultra passes directly through to the gateway without local truncation.
  • Fault Tolerance and Refresh — The adapter is registered immediately upon startup, and the catalog is pre-warmed in the background; refresh intervals, retries, and various timeouts are configurable. When the model set changes, it exposes events to notify the browser to re-read the cache.

Installation and Activation

Environment Requirements: DSH with the web profile, Node.js ≥ 20, and an environment running DSH that can access the Magpie gateway. The DSH engine range declared in package.json is >=0.2.0-rc.1 <0.2.1-0 or >=0.2.1-alpha.1 <0.3.0-0 (depending on your actual installed DSH version).

The official installation command is as follows:

dsh plugin --profile web add dsh-magpie-connect

Restart dsh web after installation. If already installed, running the same command will update to the latest version (the current version of the npm package is 0.4.1).

Typical Usage

Step 1: Fill in the Gateway Address and Key in the Settings Page

Open Settings → Magpie Gateway, confirm the following two items, and click “Save”:

  • API Address — Must include the version segment, defaulting to http://127.0.0.1:3425/v1; change to the actual address if the gateway is not on the local machine. The plugin only appends resource paths to the base URL you fill in; it will not automatically append /v1.
  • API Key — Required; even if the gateway does not validate the Key, a non-empty string is required for it to take effect.

After saving, you can click “Test Connection” to check connectivity and the number of models on the gateway. The address has a default value, but the Key does not; the model selector will be empty until the Key is filled in.

Step 2: Select Models to Display

Click Fetch Available Models, check the desired models in the pop-up, and click “Apply Selection”. The list acts as a whitelist: newly added models on the gateway will not appear automatically; you need to check and apply them in the pop-up. Deleted rows will be removed from both the list and the selector, and temporary lane fluctuations on the gateway will not secretly re-add deleted models.

Restore Default Models clears the custom list and reverts to using the full gateway catalog directly; an empty list [] and “Inherit Gateway Catalog” are two different states—the former provides no models, while the latter provides the full set.

When “Fetch Available Models” succeeds, it replaces the local catalog entirely with the current gateway catalog, and delisted models will disappear accordingly; if the read fails, the local catalog is not cleared to avoid accidentally emptying the selector. The pop-up uses the address and Key currently in the form (even if not yet saved), facilitating a single test connection when switching gateways.

Model additions and deletions are saved automatically; the address and Key require clicking “Save” to take effect.

Using Configuration Files Instead of the Settings Page (Optional)

You can write plugin configuration in the profile’s cordis.patch.yml, for example:

- id: dsh-magpie-connect
  name: 'dsh-magpie-connect'
  config:
    providerId: dsh-magpie-connect
    displayName: Magpie
    baseUrl: http://127.0.0.1:3425/v1   # Full address with version number
    apiKey: not-needed           # Usually not validated by the gateway, but must be non-empty
    refreshSeconds: 300
    maxRetries: 2
    timeoutMs: 300000
    firstEventTimeoutMs: 90000
    idleTimeoutMs: 60000

The priority is: Settings Page > cordis.patch.yml > Default Values; the settings page only overrides fields you have saved. For other configuration items (such as dataDir, various timeouts, and refreshSeconds), please refer to the table description in the README.

Use Cases and Notes

Who is it for: Developers who are already using or plan to use Magpie as a LAN gateway, want to uniformly select models within DSH Web, and require image and thinking level alignment consistent with the gateway’s declarations.

Common Issues (Excerpted from documentation):

  • Selector is empty — First confirm the address (including the version segment like /v1) and Key are saved, then “Test Connection”.
  • Image sending failed — Only supports models declared by the gateway as capable of receiving images; also, images must be read via the harness attachment service, and combinations lacking this service will also fail.
  • Upgrading from an older version — On first startup, old hiddenModels are converted to enabledModels and written to ~/.dsh-magpie-connect/settings.json; this executes only once.

The DSH ecosystem emphasizes “Everything is a plugin”; the SkillHub Plugin Directory is a community site with no official affiliation with DeepSeek / High-Flyer. Please review the source code and permission implications yourself before installing third-party plugins.

Links

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye