前言¶
在 DSH 中,composer 的模型選擇器需要依賴模型側的推理元數據,才能顯示可選的思考強度。對於自定義提供方,這類模型往往缺少 reasoningEfforts 聲明,導致無法在界面中選擇推理等級。
dsh-custom-provider-reasoning 是一個 DSH host 插件,用來補齊這一缺口:讓自定義提供方的模型都能在模型選擇器中選取思考強度(reasoning effort),並讓選擇真正發往線上。
這是什麼¶
dsh-custom-provider-reasoning 由 534119219 維護,許可證爲 MIT。
它面向 DSH 的自定義提供方,解決三類問題:
- 模型沒有可選推理等級;
- 手寫路由缺少
maxTokens或contextWindow; - 不同協議下需要手工維護路由級
compat。
它依賴以下包:
@deepseek-ai/schemastery ^3.18.1@earendil-works/pi-ai ^0.82.1
核心功能¶
下面介紹它已支持的能力。
- 讓自定義提供方的所有模型在 composer 模型選擇器中選擇思考強度,也就是推理等級。
- 選擇會經原廠適配器真正發往線上。
- 自動爲合格模型條目寫入
reasoningEfforts,默認等級爲off / low / medium / high / xhigh / max。 - 自動補齊缺失的
maxTokens和contextWindow,默認值分別爲384000和1000000。 - 感知協議類型並管理路由級
compat:在openai-completions下可爲deepseek模型補thinkingFormat: deepseek,併爲declared路由補supportsDeveloperRole: false。 - 在
openai-completions、openai-responses、anthropic-messages協議之間切換時,自動剝離不適用的thinkingFormat/supportsReasoningEffort。 - 支持通過 profile 的
cordis.patch.yml或插件設置頁配置enabled、scope、verify、maxTokens、contextWindow、thinkingFormat、defaultEffort、supportsDeveloperRole、levels。 - 注入是冪等的:已有
reasoningEfforts,或手寫的maxTokens/contextWindow,不會被覆蓋。
安裝與啓用¶
插件需要加入 web profile,默認路徑是 ~/.dsh/profiles/web。
先在 ~/.dsh/profiles/web/package.json 的 dependencies 中加入依賴:
"dsh-custom-provider-reasoning": "github:534119219/dsh-custom-provider-reasoning"
然後確認 dsh.profile.bundles 中包含插件名。實際寫入時,請把該項追加到已有 bundles 列表末尾:
{
"dsh": {
"profile": {
"bundles": [
"dsh-custom-provider-reasoning"
]
}
}
在 profile 目錄執行安裝:
cd ~/.dsh/profiles/web
pnpm install
重啓 DSH web:
dsh web
啓動後,插件會自動把 reasoningEfforts 寫入 ~/.dsh/settings.yaml 的自定義路由模型條目。
典型用法¶
啓動後打開 composer,選擇自定義提供方的模型,即可在模型選擇器中查看推理等級,例如 Default / Off / Low / Medium / High。
如果端點不認 reasoning_effort,可以在 settings.yaml 中將該模型的 reasoningEfforts 改成端點支持的拼寫,也可以直接設爲 false 關閉:
llm-pi-ai:
providers:
scnet:
models:
- id: DeepSeek-V4-Pro
reasoningEfforts:
off:
low: low
medium: medium
high: high
這個示例只用於說明配置形態。具體字段名、模型 id 和端點能力,以你的 settings.yaml 和端點實際支持爲準。
配置¶
插件可以通過 profile 的 cordis.patch.yml 或插件設置頁配置:
- id: dsh-custom-provider-reasoning
name: 'dsh-custom-provider-reasoning'
config:
enabled: true
scope: declared
verify: false
maxTokens: 384000
contextWindow: 1000000
thinkingFormat: false
defaultEffort: max
supportsDeveloperRole: false
levels:
off:
low: low
medium: medium
high: high
xhigh: xhigh
max: max
幾個關鍵點:
enabled是總開關,默認true。maxTokens和contextWindow只在對應字段缺失時回填;已有手寫值不會被覆蓋。defaultEffort管理路由級默認推理等級,默認max;路由未聲明時寫入,已有值不覆蓋;設false則關閉該管理。supportsDeveloperRole默認false,即自動爲declared路由補compat.supportsDeveloperRole: false;設true則補true。thinkingFormat默認false,不自動寫thinkingFormat;如果端點確實需要 DeepSeek 方言,可以改成deepseek。levels的鍵必須是pi-ai的思考等級,且除off外至少有一個等級,否則插件拒絕啓動。
適用場景與注意¶
適合使用 DSH host、通過自定義提供方接入模型,並且希望在 composer 中直接選擇推理等級的場景。
安裝前注意:插件以當前 DSH 進程權限運行,建議先檢查源碼與許可證,再決定是否加入 profile。
還需要注意:
- 默認按 OpenAI 兼容
reasoning_effort詞彙注入;如果端點不認reasoning_effort,請求可能報錯。 new-api/one-api系網關會拒絕developer角色;插件會自動爲declared路由補compat.supportsDeveloperRole: false。maxTokens/contextWindow只在字段缺失時回填,已有手寫值不被覆蓋。- 已有
reasoningEfforts手寫值始終權威;唯一例外是恰好等於內置默認字典的條目,會在levels變化時刷新。 - 重啓 GUI 用於加載插件本身;新增或編輯自定義提供方無需重啓。
結尾¶
dsh-custom-provider-reasoning 的價值,是把自定義提供方缺少推理等級、缺 token/context 字段、以及協議切換時 compat 難維護這些問題,收斂到 DSH host 插件裏統一處理。
倉庫地址:https://github.com/534119219/dsh-custom-provider-reasoning