dsh-llm-pi-ai-live: Real-Time Model List Refresh for llm-pi-ai Routing

Introduction

In DeepSeek Harness (DSH), when you connect OpenRouter, self-hosted gateways, or other OpenAI / Anthropic-compatible endpoints via @deepseek-ai/dsh-llm-pi-ai, the model dropdown list typically comes from a static snapshot inside the pi-ai package, rather than calling GET /models against the endpoint. The snapshot carries fields such as contextWindow and maxTokens that the listing endpoint often does not return — this is intentional; the trade-off is that newly released models will not appear automatically, and hand-written models will remain at the version entered at the time. There have been multiple community discussions about “stale lists and poor consistency with online state” (for example, deepseek-harness repository discussions #3816, #5306, #5691, #4685). dsh-llm-pi-ai-live takes a different path: instead of rewriting the discover logic inside the adapter, it uses the official settings, credentials, llm, and tools seams to fetch model ids from each route’s live endpoint, merge pi-ai catalog metadata, and write back to the configuration in an append-only manner.

What This Is

dsh-llm-pi-ai-live is maintained by WeatherWind and classified as a networked-tool DSH plugin (current GitHub stars: 0). In one sentence: for configurable provider routes using llm-pi-ai, it periodically or on-demand queries the model list on the endpoint, appends new ids into the route’s models configuration, and leaves the original configuration untouched on failure.

It does not patch the core package; nor does it replace the model discovery built into llm-pi-ai (external plugins cannot register a duplicate discovery). It addresses the problem of “the model table in the configuration being persistently out of sync with the ids actually published by the endpoint.”

Core Features

A refresh (after the startup delay, within a periodic interval, or triggered via the tool) roughly follows four steps:

  1. Plan — Read the configurable provider directory via llm.listConfigurableProviders() to obtain the settings namespace and path for each route. The namespace comes from the loader entry id in the profile (e.g., include:llm-pi-ai), so the plugin name is not hard-coded; if the profile does not load pi-ai-related entries, the plugin will not act on the wrong namespace.
  2. Interrogate — OpenAI dialect: GET {baseURL}/models (Bearer); Anthropic Messages dialect: GET {root}/v1/models?limit=1000 (x-api-key and anthropic-version). Both responses are normalized into the same candidate structure.
  3. Merge — Use the ids returned by the live endpoint to determine “which models exist”; name, contextWindow, maxTokens, and input are preferentially filled from the installed pi-ai catalog, with the capacity reported by the endpoint as a fallback.
  4. Persist — Write via settings.mutate(), reading the revision before writing and confirming the value has landed after writing.

Behavior guarantees (key points from the README):

  • Append-only: existing entries are preserved as-is by reference and order; new ids are appended at the end; ids no longer published by the endpoint are not deleted.
  • Skip when it cannot fully understand: if the stored models is not a processable list (e.g., a string, or items missing id), the entire route is skipped and explained in the report, rather than overwritten with guesses.
  • No configuration changes on failure: 5xx, timeouts, non-JSON, unparseable protocol, or rejected writes leave the route unchanged, reflected in the report.
  • No inferred fields written: only id, name, contextWindow, maxTokens, and input are written; reasoningEfforts and compat are not inferred.

Optional capability reasoning rules (reasoning block in cordis.patch.yml): for third-party models not covered by the pi-ai catalog and without reasoningEfforts declared on the route, it fills in the thinking-tier mapping according to provider / model glob rules; declared or catalog-known entries will not be modified, and rules with wrong tiers will be rejected by index in the logs.

Tool refresh_model_catalog: the optional provider parameter narrows to a single route; lets the agent pull fresh models once without a release or restart.

Installation and Activation

Plugin version 0.1.0, license MIT, Node engine requirement ^22.19.0 || >=24 (see package.json). Installation steps follow the repository README:

# 1) build
cd dsh-plugins/dsh-llm-pi-ai-live
npm install && npm run verify && npm run build

# 2) add to the target profile (local path uses link:)
dsh plugin --profile <profile> add link:$PWD

# 3) restart DSH

You can also merge the insert block from cordis.patch.yml in the repository into <DSH_PROFILE_DIR>/cordis.patch.yml.

Enable dry run on first use. When dryRun: true, it only computes and logs, without writing settings. An example of the OpenRouter live startup log from the README:

[live-catalog] mounted (first pass in 0ms, periodic refresh off, dry run)
[live-catalog] openrouter: dry run — would add 464 model(s): openai/gpt-6.1-sol-pro, ...
[live-catalog] scheduled: 1 updated, 464 added, 0 failed, 0 skipped in 932ms

After confirming the report looks reasonable, set dryRun to false.

All configuration options have default value descriptions in cordis.patch.yml; common fields are as follows:

Field Default Meaning
enabled true Master switch; when false, the plugin loads but does not schedule
startupDelayMs 10000 Delay before the first refresh after mount (ms); 0 executes immediately
intervalMs 21600000 Periodic interval (ms, six hours); 0 disables periodic refresh
timeoutMs 30000 Per-request timeout
settingsNamespaces [] Namespaces to serve; empty auto-detects pi-ai namespaces
include / exclude [] Route keys to refresh only or to exclude
enrichFromCatalog true Whether new entries are enriched from the pi-ai catalog
maxModels 2000 Maximum number of model entries stored per route
dryRun false Report only, do not write
toolEnabled true Whether to register refresh_model_catalog

If a third-party gateway needs to declare reasoningEfforts for new models, you can enable reasoning.enabled and rules (provider / model glob + efforts or efforts: false) in the patch; see the README section “Declaring reasoning effort for third-party models” for details.

Typical Usage

  1. In the target profile, complete the build and dsh plugin add link:$PWD as described above, then restart DSH.
  2. Keep dryRun: true, and observe whether the “would add” ids for each route in the logs match your endpoint.
  3. Turn off dry run, adjust startupDelayMs and intervalMs as needed, or use exclude: ['some-route'] to skip local or non-listable providers.
  4. After a new model is released, have the Agent call refresh_model_catalog, passing provider to narrow the scope if necessary — no need to edit yaml and restart.

Use Cases and Caveats

Who it’s for: developers and operators who already use DSH llm-pi-ai to connect to OpenAI / Anthropic-compatible APIs, want the model table in the configuration to stay in sync with the online state, but don’t want to manually maintain hundreds of ids.

Be sure to know:

  • The plugin runs with the permissions of the current DSH process; it makes network requests to the base URLs configured for each route and uses existing credentials. Before installing, read the source code and the MIT license, and confirm that the endpoints and key ownership are trusted.
  • It cannot replace the “fetch models from provider” path in the UI if that conflicts with the built-in discovery; it modifies the models list persisted in settings.
  • The list only grows, never shrinks; if you want to delist an id from the configuration, you still need to manually edit settings.
  • The DSH ecosystem emphasizes “everything is a plugin”; the community directory SkillHub is an independent site with no official affiliation with DeepSeek / High-Flyer (幻方).

Conclusion

dsh-llm-pi-ai-live aligns the model table of llm-pi-ai routes with the live listing using the official settings seam, without touching the core adapter, and preserves catalog metadata with a conservative write strategy. Directory page: https://www.skillhub.cn/plugins/WeatherWind/dsh-llm-pi-ai-live; source code and full documentation: https://github.com/WeatherWind/dsh-llm-pi-ai-live.

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

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

Xiaoye