Preface¶
The built-in web_search provider in DeepSeek Harness (DSH) hardcodes the endpoint and credentials to official DeepSeek. If a user configures a proxy or uses a third-party gateway (such as OpenRouter or Zhipu AI), search may fail with authentication errors. dsh-web-search-session-follow is a DSH web_search provider plugin. It reads the model provider of the current session route, uses that provider’s endpoint, credentials, and protocol dialect to perform search, and falls back to the built-in official solution when no route is recognized.
Core Features¶
- Runtime priority chain: each search attempts routes from top to bottom according to the priority list, and the first successful route takes effect. Supports the special key
sessionto follow the current session route. Priority can be adjusted in real time in the Web GUI settings panel and persisted. - Session-follow routing: reads the current session’s
{provider, model}in real time throughagents.currentInitiator().session.requestHeader().config, without caching or guessing. - Dialect routing table: supports three protocols:
anthropic-web-search: Anthropic Messages + server toolweb_search_20250305openrouter-online: chat/completions + server-side web plugin, parsingurl_citationannotationszai-web-search: Zhipu bigmodel Anthropic-compatible endpoint,web_search_primeengine, parsing stringified JSON content intool_resultblocks
- Fallback to the official solution: if the entire priority chain fails, fall back to the built-in official route (same defaults as
@deepseek-ai/dsh-web-search-deepseek). It can be disabled withfallback: none. - Settings UI panel: the “Web Search” sidebar in the Web GUI settings dialog provides priority ordering, fallback policy switching, and single-route connectivity testing (performs one real search).
- Credential separation: resolution order is literal
apiKey→ credentials service (apiKeyEnvreference) → environment variables. The chat key and search key are managed separately. - Model following: if a route does not specify
model, anthropic and openrouter dialects use the current session model, while the zai dialect uses the route model. - Invocation audit: each search appends one JSON line to
<DSH_HOME>/web-search-session-follow/audit.jsonl(including provider, endpoint, fallback, and failed/skipped attempt markers, and containing no keys).
Installation and Enablement¶
Prerequisites: DeepSeek Harness is installed (developer preview, with the dsh web command available).
1、Install the plugin locally:
dsh plugin --profile web add /path/to/dsh-web-search-session-follow
2、Override the search provider configuration in the profile’s cordis.patch.yml:
- id: web
config:
searchProvider: session-follow
3、Restart dsh web to apply the changes. To roll back, delete the override section above to restore built-in behavior.
Configuration Example¶
The plugin includes a default routing table, which can be adjusted in cordis.patch.yml or the installed copy.
config:
priority: [zai-coding-cn, openrouter]
fallback: official
routes:
zai-coding-cn:
protocol: zai-web-search
baseURL: https://open.bigmodel.cn/api/anthropic/v1
apiKeyEnv: ZAI_CODING_CN_API_KEY
model: glm-5.3-flash
deepseek-official:
protocol: anthropic-web-search
baseURL: https://api.deepseek.com/anthropic/v1
apiKeyEnv: DEEPSEEK_API_KEY
model: deepseek-v4-flash
openrouter:
protocol: openrouter-online
apiKeyEnv: OPENROUTER_API_KEY
maxResults: 5
Field descriptions:
* priority: array of route keys; may include session. Source priority: config.json saved by the settings UI > plugin config seed > ["session"].
* protocol: one of three (anthropic-web-search, openrouter-online, zai-web-search).
* baseURL: anthropic/zai dialects automatically append /messages; openrouter dialect appends /chat/completions.
* apiKeyEnv / apiKey: credential reference name / literal key (literal key takes precedence).
* model: defaults to following the session model (zai dialect fixed fallback: glm-5.3-flash).
Applicable Scenarios and Notes¶
- Applicable scenarios: users who use custom gateways (such as OpenRouter or Zhipu AI) or proxies. The plugin allows switching search endpoints and credentials by provider.
- Session log safety: This plugin never writes custom event types to session logs. If logs are polluted (for example, v0.1.0 once wrote
web/session-follow-search-requestevents), a session may be unable to be reopened from disk. To fix: add"ignorable":trueto the corresponding event lines, or wait for upstream to provide an ignorable mechanism. - Cost: all three dialects are billed as one full model invocation.
- Dependencies: zero runtime dependencies.
Conclusion¶
By decoupling search logic from session routing, this plugin solves the problem of unavailable search functionality in multi-gateway environments. Its visual settings panel and fallback mechanism lower the barrier to configuration. For more details, see the Plugin directory or Source repository.