Scorp1o117/dsh-reasoning-options ↗★ 0
dsh-reasoning-options
DeepSeek Harness 推理强度与网关增强插件:自动为 llm-pi-ai 下所有模型补齐推理强度档位(off→max 全七档),并自动为 OpenCode Go 网关注入必需的 x-opencode-session 路由 Header,写入 settings 由 dsh 原生解析生效。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Scorp1o117/dsh-reasoning-options说明文档
阅读完整 README ↗dsh-reasoning-options
GitHub: Scorp1o117/dsh-reasoning-options · npm: dsh-reasoning-options · 中文
A small DeepSeek Harness plugin that automatically adds a reasoning-effort picker to every pi-ai (third-party gateway) model, and auto-injects required routing headers (such as x-opencode-session for OpenCode Go).
Why
- Reasoning Effort Selection: dsh's built-in DeepSeek models show a reasoning-effort selector in the Web UI because the DeepSeek adapter declares reasoning capability for them. Models configured through
llm-pi-ai(OpenCode Go, GOAT, Volcengine Ark, ...) don't — pi-ai only offers effort levels for models that explicitly declarereasoningEfforts, and hand-declared gateway models never do. - OpenCode Go Compatibility: OpenCode Go (
opencode.ai/zen/go/v1) strictly requires anx-opencode-sessionHTTP header to route requests and manage prompt cache. Without it, requests fail with400: {"type":"MissingSessionID", ...}.
This plugin closes both gaps: it scans the llm-pi-ai namespace, adds the full level set (off / minimal / low / medium / high / xhigh / max) and default reasoning: high to models without declarations, and injects x-opencode-session into OpenCode Go provider headers if not already set. Writes go through dsh's native settings pipeline (schema-validated → persisted to settings.yaml → hot-applied) — no manual file editing.
The plugin only gives users a convenient way to pick and ensures gateway requirements are satisfied. Which level a model actually supports is the user's call; the plugin does not judge model fitness.
Install
dsh plugin --profile web add dsh-reasoning-options
Or mount manually in a profile patch:
- insert:
- id: reasoning-efforts
name: 'dsh-reasoning-options'
config:
enabled: true
How it works
- On boot, read the resolved
llm-pi-ainamespace (registered by the pi-ai plugin). - For each model without
reasoningEfforts, generate a mutation writing the full seven-level declaration at the exact path. - For provider routes without a
reasoningdefault, addreasoning: high. - For OpenCode Go providers (
baseURLcontainingopencode.ai), auto-injectx-opencode-session: dsh-sessionintoheadersif missing. - Writes are schema-validated by pi-ai, persisted, and hot-committed; dsh's native UI/request path takes over.
- Idempotent: models and headers that are already declared are untouched; a second scan is a no-op. Listens to
settings/updated, so models or providers added later are covered automatically.
Config
| Field | Default | Meaning |
|---|---|---|
enabled | true | Set false to stop auto-patching |
autoSessionHeader | true | Auto-inject x-opencode-session for opencode.ai gateways |
sessionHeaderValue | 'dsh-session' | Value for injected x-opencode-session header |
Want different defaults or wire values? After the patch they live in the
llm-pi-aisection ofsettings.yaml— edit them freely; the plugin never overwrites existing declarations.
Notes
- The plugin reads and mutates the
llm-pi-ainamespace but does not own it (pi-ai registers it exclusively). All writes use the publicsettings.mutateAPI — equivalent to editing via the Web UI. - Wire spellings are OpenAI-compatible (
low/medium/high/...). Most OpenAI-compatible gateways accept them; if one expects its own spelling, adjust the values in settings.yaml.