让内置 web_search 工具走 OpenRouter 兼容网关,与对话模型共用端点和密钥:支持三种请求协议,解析全部引用格式(含从引用区间还原摘要),并提供带实时连接测试的设置卡片。
安装
# npm 包(预构建)
dsh plugin --profile web add @samebits/dsh-web-search-openrouter
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:vitas/dsh-web-search-openrouter
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
Grounded web search for DeepSeek Harness, on the gateway you already pay for.
@samebits/dsh-web-search-openrouter registers a search provider on the harness's
web seam (ctx.web). The built-in web_search tool then runs server-side on
an OpenRouter-compatible gateway — the same endpoint and the same API key as your
chat models. Nothing about the model-facing tool surface changes: same tool, same
arguments, same citeable results. Only the engine behind it moves off the
harness's bundled DeepSeek search and onto your own gateway budget.
- Three protocols, one provider. Native OpenAI
web_search, OpenRouter'sopenrouter:web_searchserver tool, and the deprecatedplugins: [{ id: 'web' }]field. Pick the one your gateway accepts. - Reads every citation shape.
web_search_call.action.sources[],openrouter:web_search.action.sources[], andurl_citationannotations — including snippets sliced out of the cited span when the gateway sends no excerpt. - Editable at runtime. A card on the Plugins settings tab (English, 中文, Русский) with a Test search button that runs one real query through the saved configuration.
- No servers, no telemetry. The only outbound request is the search itself, to the endpoint you configured. Nothing is sent anywhere else.
- Dependency-free host. No
@deepseek-ai/*runtime imports, so it works in a linked development checkout as well as from the registry.

Install
dsh plugin add @samebits/dsh-web-search-openrouter --profile web
The package ships a bundle patch (dsh.bundle.patch), so that one line composes
everything: it points the web seam at this provider and inserts the provider row.
From GitHub, tracking the default branch:
dsh plugin add github:vitas/dsh-web-search-openrouter --profile web
From a local checkout (useful while editing the plugin):
git clone https://github.com/vitas/dsh-web-search-openrouter.git
cd dsh-web-search-openrouter && npm install && npm run build
dsh plugin add link:$PWD --profile web
Then store the key and restart once:
dsh credential set OPENROUTER_API_KEY # or export it before launching dsh
The credential reference is resolved per search, through the DSH credentials
service (Settings → Models) and then the process environment — so rotating a key
never needs a restart. The bundle patch is applied at boot; a linked checkout's
host entry is imported at boot too, so the first run after installing needs one
dsh web restart. After that, every settings edit from the card is live.
Quick start
- Install the package (above).
- Restart
dsh web, then open Settings → Plugins → Web search (OpenRouter). - Set Endpoint, Search model, and paste your API key.
- Press Test search — you should get a source count and the first hits.
- Ask the agent something time-sensitive; it will call
web_searchas usual.
Verified gateways
Web search is a server tool: the gateway must implement it for the model you name. The plugin reports that honestly — if the gateway answers without searching, the search fails with an explanatory error instead of silently returning the model's memory.
api.b.ai (protocol openai)
Verified working on /v1/responses with tools: [{ type: 'web_search' }], hits
returned as url_citation annotations. Cheapest first:
| Model | Citations | Notes |
|---|---|---|
gpt-5.4-nano |
2 | cheapest verified; ~8.5k input tokens per query |
gpt-5.4-mini |
4 | |
gpt-5.5-instant |
8 | |
gpt-5-mini |
4 | large input token count |
gpt-6-astra, gpt-6-sol, gpt-5.6-sol, gpt-5.5 |
1–4 |
Not supported on this gateway: gpt-5-nano, glm-*, deepseek-*, the
Anthropic and Gemini routes, :online suffixes, plugins: [{ id: 'web' }], and
openrouter:web_search.
openrouter.ai (protocol openrouter)
Use the server tool:
protocol: openrouter
baseURL: https://openrouter.ai/api/v1
model: openai/gpt-5.2 # any model with the web-search badge
engine (auto, native, exa, firecrawl, parallel),
searchContextSize (low, medium, high), maxUses, maxTotalResults, and
the domain filters are passed through as server-tool parameters. On a
non-OpenRouter gateway this protocol is rejected — that is the gateway talking,
not the plugin.
OpenAI proper (protocol openai)
https://api.openai.com/v1 + tools: [{ type: 'web_search' }]; sources arrive as
web_search_call.action.sources[] and are parsed by the same code path.
Protocols
protocol |
Wire shape | Use for |
|---|---|---|
openai (default) |
tools: [{ type: 'web_search' }] |
OpenAI, Azure, and aggregators that proxy the native tool (api.b.ai) |
openrouter |
tools: [{ type: 'openrouter:web_search', parameters }] |
openrouter.ai and gateways that adopted the server tool |
plugin (deprecated) |
plugins: [{ id: 'web', … }] |
older gateways that never adopted the server tool |
Settings reference
Every field is editable from the settings card and can be seeded from the
composition entry; a field set in settings.yaml is marked overridden in the
card and can be reset there.
| Field | Default | Meaning |
|---|---|---|
protocol |
openai |
Enablement surface (see above) |
baseURL |
https://openrouter.ai/api/v1 |
Gateway base; /responses is appended |
model |
openai/gpt-5.2 |
Model that exposes web search on that gateway |
apiKeyEnv |
OPENROUTER_API_KEY |
Credential reference, resolved per search |
apiKey |
— | Literal key; wins over apiKeyEnv (keep it out of shared profiles) |
maxResults |
5 |
Requested results, 1–25; lower is cheaper |
maxOutputTokens |
1024 |
max_output_tokens for one search turn |
includeAnswer |
false |
Return the search model's prose as content too |
engine |
— | openrouter protocol only |
searchContextSize |
— | openrouter protocol only: low/medium/high |
maxUses |
— | openrouter protocol only: cap server-tool invocations |
maxTotalResults |
— | openrouter protocol only |
allowedDomains |
— | Restrict results to these hostnames |
excludedDomains |
— | Drop results from these hostnames |
referer, title |
— | HTTP-Referer / X-Title attribution headers |
Cost
web_search is billed as tokens on the search model — not per query. A single
tool call can fan out: dsh-tool-web's searchMaxQueries (default 4) turns one
web_search into up to four gateway searches, each with its own input context.
Keep maxResults low, choose the cheapest model your gateway serves with search,
and raise searchMaxQueries only when you actually need breadth. See
docs/gateways.md for measured numbers.
Troubleshooting
| Symptom | Cause |
|---|---|
WEB_PROVIDER_CREDENTIAL_MISSING |
No key stored under apiKeyEnv; set it in the card or export it before launching dsh. |
| "the gateway ran no server-side search for model …" | The model does not expose web search on that gateway. Pick one from the verified table. |
| "Invalid value: 'openrouter:web_search'" | The gateway does not implement OpenRouter's server tool; switch protocol to openai. |
| "node only allows access to inference API paths" | A gateway-side proxy restriction; check baseURL (a stray trailing slash used to produce //responses). |
HTTP 404 on /responses |
The gateway is chat-completions-only; this provider needs a Responses endpoint. |
Development
npm install # esbuild + typescript
npm run check # host syntax check + client typecheck
npm test # 35 tests, no network, no credentials (1 skipped: the live one)
npm run check-locales
npm run build # rebuild the committed lib/client.js (also runs on npm pack)
A live smoke test is opt-in and never runs in CI:
DSH_WEB_SEARCH_LIVE=1 \
OPENROUTER_API_KEY=sk-... \
DSH_WEB_SEARCH_BASE_URL=https://api.b.ai/v1 \
DSH_WEB_SEARCH_MODEL=gpt-5.4-nano \
node --test test/live.test.mjs
Architecture, the seam contracts, and the release process live in docs/.
Privacy
The plugin stores no data and runs no background work. Per search it sends one
HTTPS request to baseURL containing your query, the model name, and the
configured parameters; the gateway's own terms govern what happens to it. The
API key is read from the DSH credential store at call time and is never written
to settings, logs, or the browser.
License
链接
同类插件
Tencent/BrowserSkill#dsh-plugin-browserskill★ 7257
BrowserSkill 的 DeepSeek Harness 浏览器自动化桥接插件,通过原生浏览器工具控制可见的 Chrome 和 Edge Agent Window,支持可访问性与 VOM 页面观察、截图、隔离的多会话控制和 Web UI 实时观察浮层。
omdsh-dev/dsh-browser#packages/browser/bridge-browser★ 726
Chrome 侧边栏扩展,让 DSH 直接操控你的浏览器,无需视觉能力。
liustack/modsearch★ 548
纯文本 agent 的联网搜索桥:搜索网页与 X,返回结构化 JSON 证据(search/fetch/引用)。
DDDMUC/dsh-free-search★ 249
DSH 免费搜索插件:7 个引擎(DuckDuckGo/Bing/SearXNG 免费 + Exa/Perplexity/DeepSeek 付费)、自动回退、设置页 UI(API key 输入 + 官网链接)、web_fetch、引擎测试工具。
Tabbit-Browser/dsh-tabbit★ 101
让 DeepSeek Harness 能够控制 Tabbit 浏览器:安装即自动加载 tabbit-browser skill,检测国际版 Tabbit 与国内版 Tabbit Browser 正式版(>= 1.9.0),检查 tabbit-cli 常驻运行时,按平台诊断调用 CLI 所需的 DSH sandbox 模式,并在没有合格版本时通过后台任务下载与系统地区匹配的正式版安装包。
wqty123/dsh-browser★ 81
共享真实浏览器:用户可观看并随时接管的原生 Electron 窗口,agent 通过 CDP 驱动,内置 20 个 browser_* 工具(打开/快照/执行/填表/截图/下载/登录态);任务级会话隔离、登录态持久化、人机验证识别,纯 `dsh web` 无需桌面外壳即可自托管。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。