Preface¶
When integrating multiple model providers into DeepSeek Harness (dsh), context window sizes, tool calling, reasoning tiers, and protocol differences often have to be looked up manually in documentation and then written into provider configurations. Whenever the model changes or the relay endpoint changes, 400 errors or mismatches between capabilities and the request body can easily occur. dsh-plugin-smart-config packages the “recommended configuration engine,” reverse-engineered and ported from ZCode, as a standard Cordis plugin. Through layered rule matching and field-level inheritance, it writes capabilities into the llm-pi-ai profile, which pi-ai reads before sending requests—rather than modifying an already-frozen Agent request body at runtime.
What Is This¶
Maintainer TACONailoong has published dsh-plugin-smart-config on GitHub (npm package name: dsh-plugin-smart-config, current version 1.1.1, MIT license). The community directory classifies it under “Model Inference,” with the description: DeepSeek Harness plugin for model smart configuration and parameter adaptation ported from ZCode.
The plugin targets dsh >=0.2.0-rc.2 <0.2.1-0; once installed, it is hooked up via cordis.patch.yml with the bundle name smart-config.
Core Features¶
Five-Layer Cascaded Recommendation Matching¶
Rules stack from most specific to fallback, ultimately producing the effectiveConfig:
- L5 Direct Match:
exactModelRules(providerId + modelId),templateModelRules(template + modelId). - L2 Model Family:
modelRulesregexes (e.g., GLM, DeepSeek, Claude, Kimi, etc.). - L3 Protocol:
modelApiRules, distinguishinganthropic-messages,openai-chat-completions,openai-responses. - L4 Site:
providerSiteRules, identifying providers or relays based onbaseUrlandapiType(the README gives examples including OpenCode, Alibaba Cloud Bailian, Zhipu, etc.). - L1 Global:
modelRules: .*provides default caps and a context baseline.
If an exact rule is manual-provider-model, only the manual configuration is used and recommendations are disabled; if it is provider-model, recommendations are inherited and personal overrides are layered on top.
Field-Level Smart Differential Inheritance¶
With smart configuration enabled, fields the user has not modified follow cloud/official recommendation iterations; individually modified items are frozen as overrides, while everything else remains dynamically inherited.
Capability Guarding and Request Parameter Translation¶
- When Tool Calling is unsupported,
toolsis intercepted and stripped to avoid 400 errors. - Multimodal (image/video/PDF) capabilities are validated with prompts.
- The generic
reasoning_effortis mapped onto each model’s request structure (e.g., Claudethinking.type, DeepSeekenable_thinking, OpenAIreasoning_effort, etc.). Programmatic translation lives inadapter.ts; since dsh 0.2 freezes Agent requests, the plugin does not modify request bodies at runtime.
Offline Rule Library and Cloud Sync¶
A built-in Revision 30 local rule set is included (per the README: approximately 20+ templates, 84+ model rules, 72+ protocol rules, 52+ site rules), with support for background polling of the server and a lease mechanism for pulling updates.
Writing Back to dsh 0.2.0-rc.2’s llm-pi-ai¶
- Only fills in missing fields for models already present in
llm-pi-ai:contextWindow,input,reasoningEfforts(viasettings.mutate); it does not writemaxTokens(in 0.2.0-rc.2 that field represents the default per-request output cap). - When
modelsis omitted or empty, nothing is modified; the pi-ai model catalog bundled with the installation continues to be used. - Host-side
openai-completionsis first mapped to the rule library’sopenai-chat-completionsso that site rules for OpenCode etc. can take effect. - Reasoning tiers only use the values accepted in 0.2:
off,minimal,low,medium,high,xhigh,max;thinkingFormatis mapped according to rules (reasoning_effort→openai,enable_thinking→deepseek). - Fields that already have values (including user modifications and catalog-provided values) are left unchanged.
OpenCode Request Headers¶
Writes User-Agent: opencode/1.0.0 and x-opencode-client: opencode into the corresponding provider’s headers; it does not modify globalThis.fetch.
Installation and Activation¶
As an npm Package for Development or Standalone Use¶
npm install dsh-plugin-smart-config
(The README also provides equivalent pnpm add and yarn add commands.)
Installing into DeepSeek Harness¶
Add the plugin under the target profile (the example uses web):
dsh plugin --profile web add dsh-plugin-smart-config
For local development, you can link it (replace the path with your local machine’s path):
dsh plugin --profile web add "link:D:/path/to/dsh-plugin-smart-config"
Before installing, please confirm that the dsh version falls within the peer dependency range; the plugin runs with the permissions of the current dsh process. You should review the source code and the MIT license yourself before installing.
Typical Usage¶
Local Testing and Demo (Node.js 22+)¶
Build first, then run the tests or the interactive demo:
npm test
npm run demo
npm run demo -- glm-5.3-flash openai-chat-completions https://opencode.ai/zen/go/v1
Programmatic Resolution of Recommended Configuration¶
Without hooking into dsh, you can also call SmartConfigService in Node/TS:
import { SmartConfigService } from 'dsh-plugin-smart-config';
const service = new SmartConfigService();
const result = service.resolve({
modelId: 'deepseek-chat',
apiType: 'openai-chat-completions',
});
console.log(result.effectiveConfig);
The returned structure contains properties (such as contextWindow, supportsToolCall, inputFormat) and optionSpecs (constraints such as maxOutputTokens, reasoningLevel, etc.).
Use Cases and Caveats¶
Suitable for: developers maintaining multiple providers and multiple models on the dsh 0.2.0-rc.2 track who want to reduce manual spec lookups and unify reasoning tiers and protocol differences; teams that need recommendation logic with the same source as ZCode and want it to take effect within DSH through the pi-ai profile.
Caveats:
- A model must first appear in the provider’s
modelslist to be patched by the profile; if the list is empty, the pi-ai built-in catalog is relied upon. 0.2.1-alphais not on the same peer line—do not assume compatibility.- The community plugin directory SkillHub entry is an independent site with no official affiliation with DeepSeek / High-Flyer.
Closing¶
dsh-plugin-smart-config ports ZCode’s five-layer rules, field inheritance, and capability guarding into the DSH Cordis ecosystem, with the key focus on syncing model capabilities into llm-pi-ai rather than tampering with frozen requests. For further details, see the GitHub repository and the SkillHub directory page.