Skip to main content
H

dsh-web-search-openai

htcqp802/dsh-web-search-openai

OpenAI-compatible web search provider for the built-in web_search tool: one baseURL/apiKey/model config powers Qwen Token Plan, OpenAI and any Responses API gateway.

Install

dsh plugin --profile web add github:htcqp802/dsh-web-search-openai

README

dsh-web-search-openai

OpenAI-compatible web search provider for DeepSeek Harness (DSH). It plugs into the harness ctx.web seam and powers the built-in web_search tool through any gateway that implements the OpenAI Responses API with the built-in web_search tool.

web_search flow

How it works

Your chat LLM (e.g. deepseek-v4) decides to call the web_search tool; the tool executes through the ctx.web seam, which routes to the provider configured here (e.g. qwen3.7-plus + your Qwen Token Plan key). Search and conversation models are fully decoupled — no model switching, no manual steps.

you ──> chat LLM (deepseek-v4, …)
            │ decides it needs live info
            ▼
        web_search tool (model-agnostic)
            │ ctx.web seam ──> configured provider
            ▼
        this provider: POST {baseURL}/responses
            tools: [{ type: "web_search" }]
            │
            ▼
        qwen3.7-plus / any compatible model ──> real search results
            │
            ▼
        chat LLM answers grounded in the results

Verified configuration

FieldValue
baseURLhttps://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 (Qwen Token Plan CN)
apiKeyEnvQWEN_TOKEN_PLAN_CN_API_KEY
modelqwen3.7-plus (also qwen3.7-max, qwen3.8-max)

Why Responses API? Built-in web search on Qwen Token Plan only triggers through the Responses API with an explicit tools: [{type: "web_search"}] declaration. The Chat Completions enable_search flag is silently ignored on that gateway. OpenAI and most OpenAI-compatible gateways expose the same shape.

Installation

Published as an npm package; one command once published:

dsh plugin add dsh-web-search-openai

For a local checkout (development), add it as a profile dependency and bundle:

cd ~/.dsh/profiles/web
pnpm add file:/path/to/dsh-web-search-openai

then add the package name to the dsh.profile.bundles list in profiles/web/package.json (append it after the shipped bundles) and restart the app. The bundle's cordis.patch.yml registers the provider and switches the web service's searchProvider to openai-search — no shipped file is modified.

Configuration

In-GUI configuration card (v0.2+)

Install the plugin and open Settings → Plugins → Plugin config: the dsh-web-search-openai card edits endpoint, credential reference, model, maxOutputTokens, and the API key (stored through the credentials service, never in config or code). Values take effect immediately — no restart needed.

Runtime precedence: UI-managed file ($DSH_HOME/dsh-web-search-openai.json)

web-search-openai: settings section > package defaults.

Configuration

Provider config lives in the web-search-openai settings section (or the plugin row in your composition):

web-search-openai:
  baseURL: https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1
  apiKeyEnv: QWEN_TOKEN_PLAN_CN_API_KEY
  model: qwen3.7-plus
KeyDefaultMeaning
apiKeyunsetLiteral API key (prefer apiKeyEnv; secrets never enter config).
apiKeyEnvQWEN_TOKEN_PLAN_CN_API_KEYCredential reference resolved per search via the ctx.credentials seam, falling back to the launching environment.
baseURLQwen Token Plan CNOpenAI-compatible base URL (no trailing /); /responses is appended.
modelqwen3.7-plusAny model exposing the web_search tool on your gateway.
maxOutputTokens1024Generated-token cap for one search call (the search itself is not truncated).

API keys

Store the key through the standard harness credential paths — the Web Models settings page, ~/.dsh/.credentials.yaml, or the launching environment — under your apiKeyEnv name.

Billing notes

Each web_search call is a full model turn on the search gateway (reasoning + tool use + grounded answer, roughly 3–4k tokens). On Qwen Token Plan, the built-in tools are billed per successful call and deducted from your plan Credits. The chat model's tokens are billed separately.

Smoke test

cd dsh-web-search-openai
npm install
QWEN_TOKEN_PLAN_CN_API_KEY=sk-... node scripts/smoke.mjs "2025年诺贝尔物理学奖得主是谁?"

Plugin surface

  • Registers a search provider (id: openai-search) on ctx.web via registerSearchProvider.
  • Registers no model-facing tools of its own; the shipped web_search tool stays the only entry point.
  • Response mapping is strict: a response without a web_search_call block fails with WEB_PROVIDER_ERROR instead of scraping prose. Sources are deduped by URL; url_citation annotations add titles when present.
  • Error codes follow the seam vocabulary: WEB_PROVIDER_CREDENTIAL_MISSING, WEB_PROVIDER_ERROR, WEB_ABORTED.

Development / publishing

npm install
node scripts/smoke.mjs            # requires a key in the environment

npm publish                       # after bumping version

MIT licensed. Fork, adapt, and swap baseURL/apiKeyEnv/model to point at any compatible gateway.

Related plugins