dsh-model-refresh: Discovering and Managing Model Catalog from pi-ai Upstream

Introduction

When integrating LLMs into DeepSeek Harness (DSH), model lists typically come from the static pi-ai catalog located in the installation directory. When upstream pi-ai releases a new version, these new models do not automatically appear in your routing configuration. Manually modifying the installation tree or ASAR files often leads to conflicts during DSH or pi-ai upgrades and makes rollback difficult.

The following is an introduction to the community plugin dsh-model-refresh (Maintainer: KouzakiUmi, Category: Model Inference). It packages “backfilling from pi-ai upstream, per-provider control, safe writing, and rollback” into an independently upgradeable DSH bundle. The goal is not to cram every model name from the internet into the selector, but to supplement the routing with new models that are genuinely available for the current provider and can be correctly materialized. The current plugin version is v0.7.2 (MIT License). Manual model-related capabilities are developed in accordance with the local DSH core 0.2.1-alpha.1’s configEditor and pi-ai interfaces; compatibility with other core versions must be verified independently.

What is this

dsh-model-refresh is a DSH plugin package containing a dsh.bundle.patch. Its displayName is “Model Catalog Refresh (pi-ai Upstream → Routing)”. The primary data source is the latest published pi-ai model catalog on npm; models.dev serves only as an optional backup source and is disabled by default. Automatic discovery and “whether to write to the installation directory” are decoupled: upon first load, it does not write to the installation directory by default, nor does it enable catalog writing for individual providers by default. These actions must be explicitly enabled in the settings page.

Runtime state is stored at ~/.dsh/model-refresh/state.json by default. Real API keys should only be placed in environment variables or the DSH credentials service; only the credential name is configured in the plugin settings.

Core Features

Automatic Discovery and Evidence Planning

  1. pi-ai as Primary Source: On startup, scheduled intervals, or manual refresh, it queries the latest pi-ai version on npm. It downloads and verifies the integrity of the official package and provider file hashes only if the version changes. The full catalog is cached in the state directory; old caches are retained if the upstream fails.
  2. Separate Model and Service Availability Checks: The upstream determines candidate IDs, protocols, and capabilities. Optional official provider lists only provide “positive existence” evidence for the current plan. A successful GET /models does not prove plan completeness or that inference has been tested.
  3. No Field Guessing: New models lacking evidence for protocol, context capacity, output capacity, and chat usage enter the Pending Confirmation state. Neighboring data is not used to guess fields.
  4. No Pollution of Native Catalog: Existing models’ native capacities, image/reasoning capabilities, etc., are not overwritten by external stale data. Sync only targets records in pi-ai with the same provider and model ID.
  5. Deletion Requires Negative Evidence: A model is only scheduled for removal if you explicitly confirm the current plan is the authoritative full list (complete: true), the response shows no signs of pagination/incompleteness, and it has been continuously missing and confirmed after a grace period (default 24 hours + 2 checks). Failures, missing keys, or partial pages will interrupt the continuous observation.
  6. Optional and Auditable Writing: Catalog writing is disabled by default. When enabled, it uses coordinated locks, write-ahead journaling, revision fingerprints, and content ownership verification. Rollback requires proof that both the current content and the catalog revision match the ledger records.

Settings Page and Monitoring

The settings page displays discovery status, applied changes, pending confirmations, conflicts, whether a consumer process restart is required, and write permission status. Users can toggle providers, configure keep / exclude lists, and view proxy and global switches. Authorization details are shown in a separate dialog; the plugin does not execute privilege escalation commands for you.

Manual Model Addition and DSH Configuration Editing

In the settings page, you can manually add models, configuring protocols, endpoints, inference tiers, and protocol compatibility parameters. You can preview, apply, and undo changes via the official configEditor, avoiding the need to modify the installation directory catalog just to try new models.

Currently supported protocols include openai-completions, openai-responses, and anthropic-messages. The same provider must use the same protocol and endpoint. When overwriting an existing provider, the original models, credentials, and other settings are preserved, and modelOverrides are merged into the model list. Declarations are stored in settings.manualModels and are not overwritten by automatic discovery.

Brief workflow:

  1. Fill in the provider name, model ID, display name, inference protocol, root URL, context and output capacities, etc., and click Save Model Declaration.
  2. Select the DSH configuration entry and target provider; enter only the environment variable or credentials name in the credential field.
  3. Click Preview Configuration Changes, review, and Apply to DSH; use Undo Plugin Changes for this Provider if restoration is needed.

Applying the configuration only indicates that the configuration passed DSH’s editing and loading workflow. It does not imply that endpoints, permissions, tool calls, or remote inference have been verified.

Artifact Format

When catalog writing is enabled, the plugin outputs <route>.models.json, <route>.models.yml, and <route>.diff.json to the state directory (or your configured path), preserving the original filenames and models array structure. Since the catalog is a static import in pi-ai, restarting the process consuming DSH is required for changes to take effect; the plugin will not restart DSH automatically.

Installation and Integration

The repository is a bundle. It is recommended to install via the plugin management entry supported by the current DSH version; do not manually modify DSH core, ASAR, or dependencies maintained by the package manager. The cordis.patch.yml only inserts dsh-model-refresh and does not modify provider routes for the user.

For local link development from source, the steps provided in the README are: install dependencies, build the client, run tests, and then load the directory via the official plugin/local link workflow of the target profile (see GitHub Repository for details). Changes to the Host or bundle source code usually require reloading the corresponding DSH consumer process.

Quick Configuration

On first use, you can copy config.example.json to a local config.json or save it directly in the settings page. Example seed configuration:

{
  "intervalMinutes": 360,
  "routes": [
    {
      "route": "opencode-go",
      "enabled": false,
      "keep": [],
      "exclude": []
    }
  ]
}

intervalMinutes controls the scheduled refresh interval (360 minutes in the example). Each route can be individually enabled and restricted via keep / exclude for the sync scope.

Environment Variables

Variable Usage
DSH_MODEL_REFRESH_STATE State path; default artifacts are also in the state directory
DSH_MODEL_REFRESH_CONFIG First-time seed configuration path
DSH_PI_AI_DATA_DIR pi-ai dist/providers/data used by the current DSH

The directory is prioritized by resolving pi-ai from the real DSH consumption entry; set DSH_PI_AI_DATA_DIR if it cannot be found.

Per-provider Official List (Advanced)

Configure this in the settings page or settings.officialRoutes, for example:

{
  "officialRoutes": {
    "kimi-coding": {
      "endpoint": "https://api.kimi.com/coding/v1/models",
      "apiKeyEnv": "KIMI_CODING_API_KEY",
      "auth": "bearer",
      "protocol": "anthropic-messages",
      "complete": false
    }
  }
}

Key points: endpoint is the full list URL, while baseUrl is the inference root URL. When complete: false, it can be used for positive discovery but cannot be used to delete models. assumeChat defaults to false; new official IDs without explicit chat type metadata will enter pending confirmation.

The Host provides a loopback Web API, such as GET /plugins/dsh-model-refresh/status, as well as POST .../refresh, .../config, .../route (requires same-origin, JSON, bounded request body).

Typical Usage (Recommended Order)

  1. Install dsh-model-refresh via the DSH plugin management entry and reload the consumer process to activate the bundle.
  2. In the settings page, enable the provider for the desired route, configure keep / exclude and the official list as needed; confirm whether to enable catalog writing (disabled by default on first run).
  3. Run a manual refresh or wait for the scheduled task, view the Pending Confirmation items in the UI, and complete manual confirmation.
  4. If writing to the installation directory or generating artifact files, restart the DSH process loading the pi-ai catalog as prompted by the settings page.
  5. If you only need to modify DSH runtime provider configuration without touching the catalog, use the Manual Model Addition workflow to preview and apply. If validation fails, undo first and then adjust the declaration.

Applicable Scenarios and Notes

Suitable for: Users who want new models from the pi-ai upstream to enter DSH routing in a controllable manner; require per-provider switches, pending confirmation gates, and rollback-able catalog writing; or want to safely add models manually via configEditor without modifying ASAR/installation trees.

Important Notes:

  • The plugin runs with current DSH process privileges; read the Source Code and README and the MIT License before installation, and assess whether it meets your environment requirements.
  • By default, it does not write to the installation directory and disables auto-discovery for providers to avoid unintended write scope expansion.
  • When migrating state from v1/v2 to v3, old files are backed up; historical additions in the old ledger that cannot prove ownership will enter the protection list and will not be automatically deleted.
  • It is recommended that only one state instance manages the catalog for the same installation directory; stop plugin consumers when updating pi-ai to avoid race conditions.
  • The community catalog entry on skillhub.cn and the GitHub repository are published by the maintainer; the DSH ecosystem emphasizes “everything is a plugin,” and this catalog is a community site with no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-model-refresh separates the backfilling of the pi-ai static catalog from “modifying the installation tree” into an upgradeable plugin: upstream follows pi-ai, writing is optional, deletions have grace periods and evidence chains, and manual models go through official configuration editing. If you are maintaining a multi-provider DSH deployment, you can start with the refresh and pending confirmation workflow in the settings page, and then enable catalog writing or manually apply configurations as needed.

  • Catalog Page: https://www.skillhub.cn/plugins/KouzakiUmi/dsh-model-refresh
  • GitHub: https://github.com/KouzakiUmi/dsh-model-refresh
羽毛球分组比赛记分
小程序二维码

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

Xiaoye