dsh-reasoning-adapter: Add Reasoning Tiers to Models with Custom Routing

Introduction

The philosophy of DSH is “everything is a plugin,” and models are no exception. The routes in the official directory come with inference metadata out of the box; you can see the levels when you open the model selector. However, if you add models to a relay, a self-hosted gateway, or a computing platform, the configuration usually only contains api, baseURL, and a string of model IDs. DSH doesn’t know which inference levels these models support or what fields to send in the request, so the levels row doesn’t display.

Manually turning on inference in “Model Settings” yields generic off / low / medium / high. Switching to models like GLM, Kimi, or Claude results in missing levels or mismatched request fields and request/response inconsistencies, leading to direct rejection.

The dsh-reasoning-adapter introduced below is a plugin designed to fill this gap. It is maintained by Hatiaa, categorized under “Model Inference,” and is currently at version 0.1.0. It lacks local dependencies for the DSH client and requires no build. Once installed, it takes effect immediately without needing configuration changes.

Core Capabilities

The plugin accomplishes one thing: it identifies the vendor based on the model name, fills in the actual levels supported by that model and the corresponding request fields, and then writes the results into your profile configuration, automatically turning on the inference switch on the “Model Settings” page.

It identifies the vendor in the order of “Model ID → Display Name → Keyword Fuzzy Match → Interface Domain”. It tolerates typos like claud or deepsek and can recognize prefixed IDs like deepseek/deepseek-v4-pro as well as relay abbreviations like cl-op-5.5. The supported vendors include Claude, GPT, DeepSeek, GLM, Kimi, Qwen, Gemini, Grok, Doubao, and MiMo.

The levels for the same model might vary when using different protocols (api). Several examples are provided in the README:

Model ID Route Protocol Selector Level Sent in Request
claude-opus-5.5、cl-op-5.5 anthropic-messages low / medium / high / xhigh / max thinking: {type: adaptive} + output_config.effort
DeepSeek-V4.1-Flash-1017 openai-completions off / low / high / max thinking + reasoning_effort,工具循环回放 reasoning_content
deepseek-v4.1-flash anthropic-messages off / high thinking: {type: enabled, budget_tokens}
GLM-5.3 openai-completions low / high / max thinking(Z.ai 格式)+ reasoning_effort
Kimi-K3.1-Pro-HighSpeed openai-completions low / high / max reasoning_effort,工具循环回放 reasoning_content
qwen3.8-max openai-completions low / medium / xhigh enable_thinking + reasoning_effort
gpt-6.1-sol openai-completions low / medium / high / xhigh / max reasoning_effort
gemini-3.5-flash openai-completions minimal / low / medium / high reasoning_effort
my-private-model 任意 不改动 —

All 28 combinations (including online values and compat fields) are in docs/levels.md. This table is generated by code, and CI verifies that it is consistent with the code. Models that cannot be recognized will not be modified: guessing the wrong level would cause the request to fail immediately, so it is better to leave it as is. Routes in the official directory are also outside the scope of processing; the plugin only handles custom routes that explicitly list both api and baseURL.

Installation and Enablement

You need DeepSeek Harness 0.2.x, confirmed via dsh --version. The plugin declares engines.dsh: ^0.2.0-0, and DSH will refuse to install if the version does not match.

# 桌面版
dsh plugin --profile desktop add dsh-reasoning-adapter
# Web 版
dsh plugin --profile web add dsh-reasoning-adapter

Restart DSH after installation. There are two ways to verify: open the model selector of a chat dialog, switch to a model with a custom route, and check if the inference levels appear; or open “Settings → Model”, where the inference switches for these models should already be enabled, and the levels should match the table above.

How It Works

The plugin operates in two layers:

  1. Runtime Matching: Every time DSH loads a model configuration, the plugin supplements custom route models with levels and compat fields. This layer only takes effect in memory and does not modify files; once the plugin is enabled, the levels appear immediately in the selector.
  2. Write Back Config: Approximately one second later, the plugin writes the same levels into the profile configuration via DSH’s built-in configuration editor (the same interface used when saving the “Model Settings” page: locking, validating, and rolling back on failure). This makes the switch on the “Model Settings” page display as enabled, and even if the plugin is disabled or uninstalled later, the levels will be retained.

Newly added models or routes will automatically match after saving. If you do not want the plugin to write to the configuration file, set writeConfig to false to retain only runtime matching.

Your Settings Take Priority

The plugin records what it has written for each model in <profile>/.dsh-reasoning-adapter/auto-match.json to determine which models you manage:

What You Did Plugin’s Handling
Added a new model Identifies vendor, writes levels, auto-opens switch
Opened the switch in “Model Settings” (generated default off/low/medium/high) Replaces with the vendor’s real levels, managed by plugin thereafter
Manually changed a model’s levels Treated as you managing it, no writing; uses your levels as-is, only fills in compat fields you haven’t written
Turned off the switch for a model Does not reopen, and the level does not display in the selector
Deleted a model Clears the corresponding record, and adding it again will be treated as a new model

For models that have been disabled or manually configured, there is a “Inference Levels (dsh-reasoning-adapter)” block below the card for each custom route in “Settings → Model”, with a Override with Plugin Levels button next to it: clicking it immediately writes the vendor’s levels into the configuration for that model and reopens the switch, after which the model is managed by the plugin again; hovering over the button shows the levels to be written. If there are multiple such models on one route, Return All to Plugin also appears. Models whose vendor cannot be recognized do not have this button; please specify the vendor using overrides first. When writeConfig: false, this section only displays status and does not provide buttons.

Configuration

The default configuration fits most situations. If adjustments are needed, edit ~/.dsh/profiles/<profile>/cordis.patch.yml and add a configuration that overrides by ID (do not write a separate insert), only writing the items that need to be changed:

- id: reasoning-adapter
  config:
    writeConfig: false
Option Default Description
enabled true Master switch
writeConfig true Whether to write the matching result into the profile configuration
replaceSettingsTemplate true Whether to replace the default levels generated by the “Model Settings” switch with the vendor’s real levels
fixCompat true Whether to supplement compat fields (adaptive thinking, reasoning_content replay, non-OpenAI vendors using system instead of developer role, etc.)
keepCommonLevels false When set to true, missing low/medium/high levels from the vendor will also be displayed and mapped to the closest real level
defaultEffort high Default level for the route. Only set when all models in the route support this level, and it only takes effect at runtime, not written to config
anthropicAdaptiveVendors [] Declares which vendors’ Anthropic-compatible interfaces support adaptive thinking (e.g., [deepseek, glm]), giving these vendors more levels under this protocol
overrides {} Rules for individual models

overrides

The key is a glob (* wildcard, case-insensitive), matching either route/modelid or modelid, taking the first matching rule in order:

- id: reasoning-adapter
  config:
    overrides:
      # 认不出的模型:指定厂商,档位和字段按该厂商规则生成
      "my-relay/my-llm": { vendor: deepseek }
      # 直接写死档位和 compat
      "*my-model*": { reasoningEfforts: { off: null, high: high }, compat: { thinkingFormat: qwen } }
      # 不让插件处理这个模型
      "some-relay/some-model": { skip: true }

vendor optional values: claude、openai、deepseek、glm、kimi、qwen、gemini、grok、doubao、mimo、minimax.

Troubleshooting

The plugin writes diagnostic information to ~/.dsh/profiles/<profile>/.dsh-reasoning-adapter/status.json (separate for each profile): reports records the vendor, basis (id/display name/fuzzy match/domain), levels, and supplemented compat for each model; models records the levels and default levels provided by DSH to the selector; match records the result of writing back to the configuration. wrote: true indicates it was written this time, reason: "already matched" indicates the configuration is already consistent and no write is needed; other reason are failure reasons, in which case the levels are still provided by runtime matching. Attaching this file when filing an issue can speed up troubleshooting.

Uninstallation

dsh plugin --profile <profile> remove dsh-reasoning-adapter

The levels written to the configuration will be retained, and the models will continue to work with these levels. If they are no longer needed, simply turn off the corresponding switch in “Settings → Model”. The plugin’s record directory ~/.dsh/profiles/<profile>/.dsh-reasoning-adapter/ can be deleted directly.

Verification Status

The author tested 11 models via two relays on DSH 0.2.1-rc.5 (Windows): each model completed a round trip with tool calls at the default level, while capturing request bodies to check reasoning fields. On the openai-completions side, DeepSeek V4.1 Flash, GLM-5.3, GLM-5.3-FlashX, and Kimi K3.1 had correct reasoning fields and correct reasoning_content replay, and system messages were sent as the system role. On the anthropic-messages side, Claude (Opus/Sonnet 5.5, Fable 5.1, adaptive + output_config.effort) and DeepSeek V4 Pro / V4.1 Flash (budget_tokens) also passed. Qwen, Gemini, Grok, Doubao, MiMo, and rules to access GPT/Claude via openai-completions, based on metadata in DSH’s built-in model directory, have not been tested. If you find incorrect levels during actual use, you can file an issue or a PR.

Applicable Scenarios and Notes

It is suitable for use in DSH with custom routes such as relays, self-hosted gateways, and computing platforms, and for those who wish to switch inference levels directly in the selector. The plugin runs with the permissions of the current dsh process. You should check the source code and license before installing. The license is MIT, and the author is HatiaaYu. Development requires no build and has no runtime dependencies. Tests use the Node built-in test runner (Node 20+); npm test runs unit tests, npm run check performs syntax checking plus unit tests, and npm run matrix regenerates docs/levels.md based on rules.js. Steps for adding vendors or correcting levels can be found in CONTRIBUTING.md in the repository.

Summary

The value of this plugin is to move the task of “knowing models” from the DSH core side to the plugin side: you only need to add models in routes, and the plugin fills in the levels and request fields based on vendor rules, writes them back to the configuration, and the levels remain even after disabling the plugin. The directory page is at https://www.skillhub.cn/plugins/Hatiaa/dsh-reasoning-adapter, and the source code is at https://github.com/Hatiaa/dsh-reasoning-adapter.

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

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

Xiaoye