DeepSeek Harness Web Search Plugin: Z.AI (GLM) Provider

The default web_search configuration of DeepSeek Harness (DSH) is typically bound to the deepseek-official provider, which requires a DeepSeek API Key. When the model routing switches to Z.AI (GLM), since only ZAI_API_KEY exists in the environment, search requests will fail with 401 authentication errors. The dsh-web-search-zai plugin solves the web search requirement under GLM routing by registering the zai-official provider and leveraging Z.AI’s Anthropic-compatible interface to invoke the native web_search_20250305 tool.

Core Features

This plugin provides the following capabilities:

  • Z.AI (GLM) Web Search Provider: Installed and configured specifically for DSH running GLM models, replacing the default DeepSeek search provider.
  • Native Interface Support: Implements native web_search behavior through the Anthropic-compatible Messages API and the web_search_20250305 tool.
  • Zero Dependencies: Released as a standalone DSH profile package with no dependency on other npm packages.
  • Fault Tolerance: Retries transient upstream failures (such as 5xx errors, timeouts) up to 3 times.
  • Data Parsing: A citation-aware scanner extracts title, link, and content records from the mixed format (Python-repr/JSON) returned by Z.AI.

Installation and Activation

Install the plugin in the web profile (i.e., the profile containing the web passthrough):

dsh plugin --profile web add @canary-builds/dsh-web-search-zai

Restart DSH after installation for the changes to take effect. To update, simply run the above command again and restart.

If there is existing manual configuration for the web line in cordis.patch.yml (e.g., a manually specified searchProvider), please remove this override first, as the config file patch takes precedence over the patch within the plugin package.

Configuration Notes

The plugin does not provide a UI settings card; relevant constants are defined in index.js:

Constant Name Default Value Description
MODEL glm-5.3 Model executing search turns
MAX_USES 3 Server-side tool search count per request
MAX_TOKENS 512 Completion budget (sources are in tool blocks, keep budget small)
MAX_ATTEMPTS / RETRY_DELAY_MS 3 / 700 Retry strategy for transient failures
REQUEST_TIMEOUT_MS 45000 Single attempt timeout
API_KEY_REF ZAI_API_KEY Credential store reference

Notes and Caveats

  • Credential Requirement: The Z.AI API Key must be stored as the ZAI_API_KEY credential. If the plugin fails to detect this credential at runtime, it will throw a WEB_PROVIDER_CREDENTIAL_MISSING error.
  • Billing Mode: Each search generates a GLM model call, billed similar to a small model invocation—it is not a free search API.
  • DSH Version Compatibility: This plugin relies on contracts released in DSH web passthrough version 0.1.x (registerSearchProvider / WebSearchProvider). If DSH updates change these interfaces, retesting is required.
  • Behavior Details:
    • The plugin only reports available() as true when the credential service exists.
    • Multiple search turns within the same request will deduplicate URLs.
    • Content snippets are limited to 400 characters.
    • Full cancellation support (WEB_ABORTED) is provided.

Switching Back to DeepSeek

To restore the DeepSeek official search provider:

  1. Store DEEPSEEK_API_KEY in the credential service.
  2. Remove the current plugin: dsh plugin --profile web remove @canary-builds/dsh-web-search-zai.
  3. Restore searchProvider: deepseek-official in the web line configuration.

The plugin registers the provider via web.registerSearchProvider; the registration is automatically cleaned up upon uninstallation, restoring the base configuration on next startup.

For more information or to submit issues, please visit: GitHub Repository

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye