dsh-magpie-lite: Integrating Local magpie-lite Gateway Model into DSH Model Selector

Preface

When developing agents in DeepSeek Harness (DSH), model sources are often scattered: official Providers, self-built gateways, local Ollama, etc., each with their own set of configurations. If you are already running a magpie-lite gateway on your local machine to unify DeepSeek, GLM, Kimi, OpenRouter, Ollama, etc., into an OpenAI-compatible http://127.0.0.1:19998/v1, and then re-enter the endpoint and model list in DSH, it is not only prone to inconsistencies with the gateway console but also hinders Claude Code, Codex, and DSH from sharing the same model set.

The following introduces the community plugin dsh-magpie-lite (Maintainer: hualuo520-h). It registers the local magpie-lite gateway as a standard Provider in DSH. A magpie-lite group will appear in the model selector, listing the models enabled in your gateway. Configuration changes on the gateway side are shared across all Agents.

What is this

dsh-magpie-lite is a model inference plugin for DSH, positioned as a “bridge layer” rather than a gateway itself. The plugin reads magpie-lite’s config.json, constructs a Provider on openAICompletionsApi via @earendil-works/pi-ai, and registers a magpie-lite adapter with DSH. Request bodies are not rewritten by the plugin; protocol conversion, streaming output, and tool calls are all handled by the magpie-lite gateway.

The data flow can be summarized as follows:

DSH Model Selector (e.g., magpie-lite/deepseek-chat)
        ↓
dsh-magpie-lite
        ↓ Locates config.json, registers adapter
magpie-lite gateway  http://127.0.0.1:19998/v1
        ↓ Routes based on provider/model prefix
DeepSeek / GLM / Kimi / OpenCode Zen / OpenRouter / Ollama / Pollinations etc.

The current version of the plugin is 1.0.0 (MIT License), depending on Node ^22.19.0 or >=24.0.0. Community catalog page: skillhub.cn/plugins/hualuo520-h/dsh-magpie-lite; Source code and documentation: GitHub - hualuo520-h/dsh-magpie-lite. The catalog site is a community ecosystem site and has no official affiliation with DeepSeek / High-Flyer.

Core Features

Model Grouping and Shared Configuration

After installation, the DSH model selector adds a magpie-lite group, with entries corresponding to models enabled in your gateway console. The gateway’s config.json serves as the single source of truth: after changing ports, gatewayKey, or adding/removing models, the plugin will read the same file without the need to maintain a separate model list in DSH.

Automatic Gateway Configuration Discovery

Gateway installation paths vary across machines. The plugin resolves config.json in the following order (<DSH home> refers to the environment variable DSH_HOME, or ~/.dsh if not set):

  1. The file pointed to by the environment variable MAGPIE_LITE_CONFIG
  2. $MAGPIE_LITE_HOME/config.json
  3. Pointer file <DSH home>/magpie-lite.json (written by the gateway upon startup, pointing to its config.json; this is the primary mechanism when the gateway is running)
  4. <DSH home>/magpie-lite/config.json (conventional path when the gateway is not running)
  5. The config.json bundled alongside the plugin package

The pointer remains up-to-date while the gateway is running; if not running, it falls back to the conventional path and prompts the expected location, rather than silently displaying zero models.

Hot Configuration Updates

The plugin listens for changes to config.json (with a debounce of approximately 400 ms) and re-registers models; restarting DSH is generally not required. If you add or remove models or change Providers on the gateway management page, changes will be reflected in the selector after saving (based on the list in config.json, rather than real-time queries to the upstream).

Free Model Display Names

If a Provider explicitly sets "free": true in config.json, the display name in the DSH selector will have a (Free) suffix (e.g., openai(Free)); the model ID (provider/model) remains unchanged, and routing and invocation are not affected. Not filling in an API Key does not automatically classify it as free, to avoid mislabeling Providers like DeepSeek and Zhipu that require Keys.

Installation and Activation

Before installation, please confirm: magpie-lite gateway is installed and currently running; this plugin only performs bridging on the DSH side. Ensure at least one Provider has a Key configured and the switch is turned on; otherwise, the plugin will still load but the group will be empty (DSH hides empty groups). For gateway auto-start setup, refer to register-autostart.ps1 in the gateway directory.

DSH Settings → Plugin Marketplace → Search for dsh-magpie-lite → Install. This path uses the pre-built npm package and typically does not require allowBuilds approval.

Command Line

dsh plugin --profile web add dsh-magpie-lite

Manual Installation

Copy the repository content to the dsh-magpie-lite plugin path under your user directory, add dsh-magpie-lite to dsh.profile.bundles in profiles/desktop/package.json, and restart DSH. When installing from source, pnpm may intercept build scripts; you need to configure allowBuilds yourself in the profile’s pnpm-workspace.yaml; the npm package is pre-built and requires no such step. Specific copy commands can be found in the PowerShell examples in the README.

After installation, restart or follow the DSH plugin loading process to activate it, and check if the magpie-lite group appears in the model selector.

Typical Usage

Enabling Models on the Gateway Side (First Time)

  1. Ensure the gateway is started (default admin address http://127.0.0.1:19998/admin).
  2. Add API Keys for various upstream Providers and turn on the switches for models you wish to use.
  3. Select entries formatted as magpie-lite/<provider>/<model> in DSH to start chats or run Agents.

Customizing config Path or Installation Directory

If config.json is not in the default location, set environment variables and restart DSH:

  • Point directly to the config file: MAGPIE_LITE_CONFIG=<absolute path to your config.json>
  • Point to the gateway suite root directory: MAGPIE_LITE_HOME=<gateway directory>

Standalone Diagnostics (Without starting DSH)

Execute the following in PowerShell (paths are based on Windows user directory; for Linux/macOS, change to the corresponding ~/.dsh path):

node "$env:USERPROFILE\.dsh\profiles\node_modules\dsh-magpie-lite\lib\bin.js"

The output includes the actual config.json used, routing, Key fingerprints, and the list of models to be registered. If the count is 0, the issue usually lies on the gateway side rather than DSH. For gateway logs, refer to <gateway-dir>\data\gateway.watch.log and data\boot.log.

Use Cases and Notes

Who it is for: Developers who are already using magpie-lite locally to unify multiple upstream models and wish for DSH, Claude Code, Codex, etc., to share that same set of models in the gateway.

Prerequisites:

  • The gateway must be running; the plugin does not replace gateway installation and forwarding.
  • At least one Provider is enabled in config.json.
  • Node version satisfies the plugin’s engines requirements.

Known Limitations (Excerpts from official documentation):

  • The model list comes from config.json, not a real-time enumeration of upstream sources.
  • The plugin only declares text modality; multimodal availability depends on the upstream model.
  • stop sequences are not supported (a limitation at the pi-ai level).

Security and Permissions: DSH plugins run under the permissions of the current DSH process and will read gateway configurations and environment variables on the local machine. Before installation, it is recommended to review the source code and MIT License on GitHub to ensure consistency with your workspace policies; do not directly copy unreviewed plugin packages in untrusted environments.

Conclusion

dsh-magpie-lite integrates the local magpie-lite gateway into DSH as a standard Provider: one centralized gateway configuration, a unified magpie-lite group in the selector, and hot updates for configuration changes. If you are using magpie-lite to aggregate multiple models, you can enable it using the installation commands above and verify successful model registration with the standalone diagnostics CLI.

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

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

Xiaoye