@ztyss/dsh-llm-provider: Take over DSH Model Service and Settings Interface

Introduction

Integrating multiple model providers into DeepSeek Harness (DSH) typically requires modifying multiple components, such as the pi-ai adapter, DeepSeek adapter, model selector, and the Models settings page. Additionally, the official release cadence may not always be synchronized with the new models arriving in @earendil-works/pi-ai. If you wish to switch providers, select models, and view quota within the same Web interface—and use the latest pi-ai from npm without waiting for a dsh upgrade—you need to centrally replace these capabilities and maintain them yourself. Below is an introduction to the community plugin @ztyss/dsh-llm-provider (Maintainer: Ztyss, Category: Model Inference) and how it fully takes over the aforementioned modules while providing configuration and quota display.

What is this

@ztyss/dsh-llm-provider is a DSH plugin that takes over the official llm-pi-ai and llm-deepseek adapters, the ui-model-selection selector, and the ui-settings-models Models settings page. It replaces them with a self-maintained pi-ai bridge, model selector, quota query interface, and provider management UI. This repository is forked from imchangchang/dsh-llm-provider and is now independently maintained by Ztyss. The README indicates the current version is v0.2.6, and installation uses the main branch. The lib/ build artifacts are distributed with the repository, making it ready to use immediately after installation.

Core Features

pi-ai Bridge and “Enable Latest Version”

The settings page Provider → pi-ai Bridge provides an “Enable Latest pi-ai” toggle. This allows the official pi-ai adapter to run on the latest version of @earendil-works/pi-ai fetched from npm, replacing the version bundled with DSH. This means you do not have to wait for a dsh release to support new models in pi-ai.

When toggled ON, the plugin fetches dist-tags.latest from the npm registry. After sha512 verification, decompression, dependency closure checks, and import inspection, it places the files in the safe zone $DSH_HOME/llm-provider-bridge/pi-ai/<version>/. After a restart, the bridge points to this copy. If the inspection fails, it automatically falls back, ensuring the toggle always has a safety net. Toggling OFF reverts to the DSH-bundled version; downloaded files are retained, so toggling ON again does not require a re-download. Switch preferences are written to $DSH_HOME/llm-provider-bridge/vendor-status.json to prevent preference loss if the plugin directory is rebuilt by the package manager.

Network access is only triggered when the switch is ON: once when toggled, and once during every startup check (if there is no ready copy locally, it downloads it; if a copy exists, it checks npm for updates). Toggling OFF does not trigger network access. The version line in the UI displays the current version in use and its source (DSH Bundled / npm Latest / vendor). On the right side, explanations are provided for statuses like downloading or pending restart. The restart requirement is derived from piAiNeedsRestart, with polling approximately every 2s during downloads.

Model Service Settings Page

  • Bilingual (Chinese/English): Uses dsh’s locale mechanism, switching languages in real-time.
  • Inline Provider Card Editing: Display name, API URL, protocol, and credential name can be edited directly on the card. If there are no changes, no editing traces are shown; if there is a draft, “Save Changes / Cancel” appears. Route IDs are read-only.
  • Model List as Checklist: Expand “Models (N)” to check and enable models. Saving sends a POST /provider/set-models request; the server validates and rejects built-in routes. “Follow Directory (Restore)” deletes the specific key to return to the full directory list.
  • Custom Route Candidates: For routes where the id is not in the pi-ai directory, map to the directory provider with the same endpoint based on baseURL; candidates come from directory models. If a manually entered name matches a directory entry, the directory metadata takes precedence.
  • Model Testing: Routes without a baseURL can fall back to the pi-ai factory official default endpoint (only for directory ids).
  • Instant Saving: After adding, deleting, or checking models, the local detail index, directory, and quota snapshot are updated simultaneously without waiting for a slow host refresh.
  • Delete Confirmation: Includes a cost description and an “Export Configuration (YAML)” backup option (keys are not exported).
  • Capability Badges: Three states: Supported / Explicitly Not Supported / Unknown. Models not found in the directory are supplemented from route declarations and adapters.

For providers requiring console sessions (e.g., StepFun Step Plan points), cookies are stored in $DSH_HOME/llm-provider-bridge/.cookies.yaml (single file, dot-prefix). The structure is similar to credentials (version + flat key table), where the key is the credential ref name (e.g., STEPFUN_CONSOLE_COOKIE). The legacy stepfun-console-session.json is migrated into the new file upon first read and then removed. When writing to disk, seed fingerprints are deduplicated to avoid repeatedly writing back static credentials; the seed must contain the Oasis-Token segment to prevent fragments from overwriting rotated jars.

Model Selector

With the official model selector disabled, this plugin provides the current model status, the /model command, and the model directory state machine. /model supports filtering and searching by provider, with candidates grouped by provider and displaying quota/balance. For synthetic providers like modlens-<upstream> and deepseek-modlens, the chips, quota next to the input box, and the /model panel fetch data from the upstream account. When the selector is expanded, model details are re-fetched, so custom models added in the settings page immediately appear with capability badges. To implement the official / command contract, the plugin provides available(session): sessions addressed as sub-agents will not show model selection. The implementation does not throw errors outward; exceptions are swallowed and passed through.

Stability and Security (Summary)

Validates the manifest, entry point, and import subpaths of the official bundle before loading; piAiCandidates() inspects candidates in the order: Safe Zone → vendor legacy → built-in → dsh bundled, selecting the first one that passes. The bridge workspace is located outside the package in $DSH_HOME/llm-provider-bridge/, with zero links inside the installed plugin package (test/host-safety.mjs regression test). When the host resides in app.asar, specifiers within the bridge copy are converted to file:// URLs for the archive entry to avoid dangling junctions/symlinks inside asar; both the ON and OFF paths for enabling the latest pi-ai are covered.

Installation and Activation

If the repository is private, git credentials must be configured first (e.g., gh auth login). The installation command is as follows (excerpt from README):

dsh plugin --profile web add github:Ztyss/dsh-llm-provider   # Private repo, git needs credentials (gh auth login is sufficient)
dsh web     # Restart required: Plugin tree is assembled at process startup

After installation, run dsh web; the plugin tree is assembled at process startup, so a Web process restart is required after changes. If you modify the source code yourself, run npm run build in the repository and commit both lib/ and src/ (the repository intentionally has no prepare script to avoid failures when pnpm installs from git).

Typical Usage

  1. Install the plugin and restart dsh web, then open the Models / Provider related settings pages.
  2. Fill in the API URL, protocol, and credential name inline on the provider card; changes take effect immediately after saving.
  3. Expand the “Models (N)” for a route, check the models to enable, and save; use “Test” to verify connectivity if needed.
  4. If the latest pi-ai from npm is required, turn on “Enable Latest pi-ai” in pi-ai Bridge, and restart after the download completes as prompted by the UI.
  5. Use /model in a session to browse, search, and switch models by provider. Quota/balance can be viewed next to the groups (depending on the specific provider’s query implementation and credential configuration).

In-repo self-testing (does not require running dsh):

npm test                      # Build + 18-step offline test chain
node test/host-safety.mjs     # Junction safety regression; recommend running on both node 24.14 and DSH bundled runtime (≥24.15)

Use Cases and Notes

Suitable for: Users who want to uniformly manage multiple LLM providers and model lists on the DSH Web side, view quotas, and optionally track the latest @earendil-works/pi-ai from npm; users who accept replacing several official built-in UI and adapter entries with a community plugin.

Note: The plugin runs with the permissions of the current dsh process. Before installation, you should read the source code and license of the GitHub Repository and evaluate credentials, cookies, and outbound network access yourself (accessing npm occurs when the latest pi-ai switch is ON). The DSH community plugin directory is an independent site SkillHub Plugin Page and has no official affiliation with DeepSeek / High-Flyer. The directory summary is “Full takeover of model services, providing intuitive configuration and quota display.” The GitHub star count is 1 (based on public directory/repository information).

Conclusion

@ztyss/dsh-llm-provider consolidates pi-ai / DeepSeek adaptation, Models settings, and the model selector into a single self-maintained implementation, supplementing it with quota display and pi-ai version bridging. Installation and behavior are subject to the README. For more information, see the SkillHub Directory Page and GitHub: Ztyss/dsh-llm-provider.

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

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

Xiaoye