Introduction¶
In DeepSeek Harness (DSH), model selection typically happens within the /model selector. Manually selecting simple or advanced models works, but request complexity varies within a single session: sometimes it is just confirmation or summarization, and sometimes it requires multi-step reasoning or handling error loops. For those using DSH for agents, toolchains, or local workflows, repeatedly switching models interrupts the process.
llm-adaptive addresses this issue by providing an adaptive provider: it performs complexity classification for every request first, and then selects a backend provider based on the routing chain in pool.json.
What is it¶
llm-adaptive is a DSH plugin for per-request complexity classification and provider routing. The repository is located at https://github.com/dylan121322/llm-adaptive and is licensed under MIT.
It extends DSH’s model selector with an adaptive entry and routes between four levels: low, medium, high, and critical. Explicit low, medium, high, and critical models are also retained in the picker and can be selected directly.
Core Features¶
Classification on Every Request¶
The classifier uses deepseek-v4-flash, called directly without a proxy, and does not cause recursion.
Every request is classified into one of low, medium, high, or critical.
Integrated Session Context¶
The classification prompt injects the rolling session goal summary and the last few turns of conversation, combined with rules like continuation, wrap-up, and error-loop to determine if the current request requires a higher or lower routing level.
Sticky Level Protection¶
While a task is in progress, the plugin will not easily downgrade the current request to a lower level. Without explicit downgrade or wrap-up signals, the request will remain at the previous level.
Configuration-Driven Routing Chain¶
The routing chain comes from:
pool.json -> routing.levels
Where $active expands to the active provider. Missing items fall back to defaults; transport failures try down the chain.
Classifier Configuration from Pool¶
Classifier URL, model, and key references all come from the classifier section in pool.json:
url
model
key_ref
The plugin does not hardcode credentials. key_ref is first resolved against ~/.dsh/.credentials.yaml and falls back to the api_key in the pool on failure.
Fail-open¶
If classification fails, the request degrades to medium. The plugin does not block the request because of this.
Observable Decisions¶
Every decision is written to the plugin log, including level, cause (llm / sticky / cache), and chain.
The log path is:
~/.dsh/hooks/plugin.log
120-Second Decision Cache¶
The plugin maintains a 120-second decision cache, with the cache key composed of the user-text head and goal fingerprint.
Prerequisites¶
Before using it, you need:
- DeepSeek Harness (dsh)
- Model pool file:
~/.dsh/tools/cc-switch-sync/pool.json
- The
classifiersection inpool.json:url,model,key_ref - The
routing.levelsinpool.json:low,medium,high,critical - A DeepSeek API key for the classifier
The package declaration includes:
peerDependencies: @deepseek-ai/dsh-llm >=0.0.1-rc.5
dsh.bundle.patch: ./cordis.patch.yml
pool.json can be generated by the cc-switch-sync import tool or written manually. The plugin reads it on every request, so changes take effect immediately upon modification.
Installation & Enable¶
Installation command:
dsh plugin add llm-adaptive
After installation, restart the dsh web service and select:
adaptive
Typical Usage¶
-
Open
/modeland selectadaptive. -
Every subsequent LLM request will be classified as
low,medium,high, orcritical. -
The request will be routed to the first available provider in that level’s chain.
-
Decisions are written to the log, formatted like:
level=… cause=… chain=…
The log is located at:
~/.dsh/hooks/plugin.log
Explicit levels low, medium, high, and critical are also listed in the picker and can be selected directly without relying on automatic classification.
Suitable Scenarios and Notes¶
Suitable for DSH users who want to reduce manual model switching while still retaining explicit level selection. It is also suitable for scenarios that require switching between different providers based on session complexity.
Note:
- The plugin runs with the permissions of the current dsh process; you should check the source code, dependencies, and local configuration paths before installing.
- The plugin reads
pool.jsonand resolves~/.dsh/.credentials.yamlviakey_ref; key references should only point to sources you trust. - Classification failures fail-open to
medium, and the request will continue. - The availability of the routing chain depends on the configured providers and transport in
pool.json. - The license is MIT and the repository address is
https://github.com/dylan121322/llm-adaptive.
Conclusion¶
llm-adaptive adds a configuration-driven auto-routing entry to DSH: every request is classified based on context and then enters the low / medium / high / critical routing chain; it remains available even if classification fails, and writes decisions to the log.
GitHub: https://github.com/dylan121322/llm-adaptive
The index page entry can be found in the “Awesome DSH Plugin” badge in the GitHub README.