Model Capability Autofill for DeepSeek Harness

Introduction

After importing models from an API gateway that is compatible with OpenAI / Anthropic, the model selector often lacks a “reasoning effort” option, and the input box refuses to accept image uploads. This happens because the relay’s /models endpoint only returns model IDs without capability metadata; the llm-pi-ai adapter in DeepSeek Harness treats models with undeclared capabilities as “no reasoning, text-only.”

This plugin automatically fills in the missing fields within approximately 1 second after you add or modify a provider in Settings > Models, eliminating the need to manually edit cordis.patch.yml.

What It Is

A DeepSeek Harness plugin: after importing models from a relay station / API gateway, it automatically fills in reasoning levels (reasoningEfforts) and vision (input) capabilities.

  • Maintainer: lin-0407
  • Applies to: the llm-pi-ai multi-provider adapter in DeepSeek Harness (Desktop / Web)
  • Dependencies: zero npm dependencies, runs offline, no network calls, does not read API keys
  • License: MIT

Core Features

The plugin reads each model’s capabilities and only fills in what’s missing. The fields it fills include:

Field What It Fills
reasoningEfforts The levels offered by the model + the exact spelling sent upstream for each level
input ["text","image"] (multimodal) or ["text"]
contextWindow / maxTokens Actual context and output limits (can be disabled)

Determination priority:

  1. Local pi-ai directory (authoritative): reads the @earendil-works/pi-ai bundled with DeepSeek Harness, where the thinkingLevelMap and input for 1241 model IDs represent the true upstream capabilities.
  2. Built-in snapshot lib/catalog-snapshot.js: generated from the same directory, used as a fallback when the runtime directory is unreadable (fully offline-capable).
  3. Family rules lib/families.js: IDs not in the catalog (renamed by relays, version suffixes added, newly released models) are inferred by series.

ID matching handles common relay renames, for example:
- openai/gpt-5.1, @cf/zai-org/glm-5.3, us.anthropic.claude-...
- :free / :batch, deepseek-v4.1-flash-1017 → deepseek-v4.1-flash
- gemini-4-argon-high → gemini-4-argon

Installation & Activation

Prerequisite: DeepSeek Harness is installed and running (this plugin targets its llm-pi-ai adapter).

  1. Clone this repository to any directory:
git clone https://github.com/lin-0407/dsh-model-capability-autofill.git
  1. Install into the current profile, either way:
    - Plugin panel: Plugins → Add plugin → select the directory from the previous step;
    - Let the agent install: plugin_manager → action: install_bundle → target: <absolute path of the directory from the previous step>.

  2. The plugin takes effect immediately after installation; however, updating the plugin code afterward requires restarting DeepSeek Harness (installed JS modules are cached by URL).

  3. Verify: after importing a relay provider, check whether reasoning effort options appear in the model selector.

Configuration

Configuration is written in the model-capability-autofill line of the current profile patch. Defaults are the recommended values:

- insert:
    - id: model-capability-autofill
      name: dsh-model-capability-autofill
      config:
        enabled: true        # master switch
        autoApply: true      # false = detect and report only, no config changes
        fillCapacity: true   # whether to also fill contextWindow / maxTokens
        dryRun: false        # dry run
        namespace: llm-pi-ai # settings namespace that owns relay routes
        debounceMs: 350
        startupDelays: [1200, 4000, 10000]

The plugin does not declare a Config schema, so it does not appear in the “Settings” form. Toggle it by editing the patch line.

Tool: model_capability

A diagnostic / remediation tool for the model:

action Purpose
lookup (model required) Explains how a model ID is resolved: matched pi-ai catalog entry + provider, or family rule; levels, modality, context
pending Lists fields that “will be filled” in the current config, without writing
apply Runs a fill pass immediately
status Plugin config, catalog source, last run result

Example output:

deepseek-v4.1-flash-1017: off/low/high/max, input text+image,
source pi-ai catalog entry "deepseek-v4.1-flash" (qwen-token-plan), context 1000000, max output 384000

Write Strategy

  • Existing reasoningEfforts, input, contextWindow, maxTokens are always preserved; reasoningEfforts: false is treated as “explicitly no reasoning”;
  • Only empty objects / null (invalid values that the adapter rejects) are repaired;
  • Route-level defaultInput is respected: already-declared modalities are not re-written, and the scope is never narrowed;
  • Idempotent: running after a fill produces no writes;
  • Writes go through ctx.settings.mutate('llm-pi-ai', ops, revision) — the same version-checked service endpoint used by the Settings > Models page. Concurrent saves detect conflicts, re-read, and recompute without overwriting a form you’re currently editing; config persists in the profile’s cordis.patch.yml.

Use Cases & Caveats

Ideal for developers who need to import models from API gateways and want the model selector to automatically expose reasoning levels and image understanding capabilities.

The plugin runs with the permissions of the current dsh process. Review the source code and license before installing.

Known Limitations

  • Does not validate the gateway: the levels written use the official spellings supported by the upstream model; if a relay only accepts certain values, selecting an unsupported value may still result in a 4xx rejection. This is “declaring capabilities,” not “probing capabilities.”
  • Does not modify compat.thinkingFormat: some OpenAI-compatible gateways require this to actually parse thinking parameters; this plugin deliberately avoids touching it to prevent introducing request-level changes to unknown gateways.
  • Multimodality is a declaration: if image is declared but the gateway doesn’t support it, the failure occurs at the upstream request after the image is pasted.
  • Only processes routes that the user has explicitly written into the profile: providers inherited from lower-level bundles are left untouched.
  • The catalog can become stale: after upgrading pi-ai, run node scripts/build-snapshot.mjs to regenerate the snapshot.
  • When the platform rewrites the profile patch, it may normalize out empty-value entries in reasoningEfforts (e.g., off:) — this is not caused by this plugin’s writes; simply restore the “off” entry if you need a “disable reasoning” level.

Self-Test

node test/run-tests.mjs

68 checks: common relay ID resolution, Gemini protocol level trimming, fill-only-what’s-missing, route defaultInput respect, idempotency, empty-object repair, write retry during loader hot-reload, real write path (mock settings service). Runs even without a DeepSeek Harness installation (falls back to the built-in snapshot).

Verified in practice: on a real local profile, 7 imported models had contextWindow / maxTokens filled in, followed by a re-check confirming no-op; model_capability’s lookup / status work correctly.

Directory & Source

  • Directory page: https://www.skillhub.cn/plugins/lin-0407/dsh-model-capability-autofill
  • GitHub: https://github.com/lin-0407/dsh-model-capability-autofill
羽毛球分组比赛记分
小程序二维码

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

Xiaoye