dsh-web-search-zhipu
partingqaq/dsh-web-search-zhipu
GLM(智谱)网页搜索 provider——把 web_search 后端切到智谱 Anthropic 兼容端点的服务端搜索工具,直接复用你现有的 GLM 额度或 Coding Plan,替代 DeepSeek 官方搜索通道,并内置智谱私有响应格式的翻译层。
安装
dsh plugin --profile web add github:partingqaq/dsh-web-search-zhipuREADME
dsh-web-search-zhipu
为 DeepSeek Harness (DSH) 编写的 GLM(智谱 bigmodel)网页搜索插件。让 DSH 的 web_search 工具走智谱的 Anthropic 兼容端点(https://open.bigmodel.cn/api/anthropic/v1),消耗你现有的 GLM 额度 / Coding Plan,替代官方 dsh-web-search-deepseek 的 DeepSeek 通道——不需要 DeepSeek 平台余额,也不需要再注册任何搜索服务。
简体中文 | English
为什么需要它
智谱端点功能上支持 Anthropic 的 web_search_20250305 服务端工具,但返回的不是标准 Anthropic 布局:
| Anthropic 标准(DSH 要求) | 智谱实际返回 | |
|---|---|---|
| 结果块类型 | web_search_tool_result | tool_result |
| 内容格式 | 结构化数组 {type:"web_search_result", url, title} | Python-repr 风格字符串 |
| URL 字段 | url | link |
本插件内置格式翻译层(lib/repr.js),两种布局都能解析、按 URL 去重、拼接引用摘要——web_search 工具保持稳定的 schema 与引用卡片,后端则计费到你的智谱账户。
安装
插件市场收录后可直接安装,或:
dsh plugin --profile web add dsh-web-search-zhipu
然后重启 dsh web。插件会注册搜索 provider glm-bigmodel,并随附 patch 将 web.searchProvider 指向它。
要求:
- DSH web profile,
dsh >= 0.1.1-rc.1(在 0.1.1-rc.2 上验证) - Node.js >= 20
- 智谱 bigmodel API key,存于 DSH 凭据服务,键名
ZAI_CODING_CN_API_KEY(通常就是 agent 的 GLM 模型在用的那把)
配置
默认零配置可用;设置页 → 插件里会出现 web-search-glm 配置节。
| 配置项 | 默认值 | 说明 |
|---|---|---|
apiKeyEnv | ZAI_CODING_CN_API_KEY | 凭据服务里的 key 引用 |
baseURL | https://open.bigmodel.cn/api/anthropic/v1 | 也可用环境变量 GLM_SEARCH_BASE_URL 覆盖 |
model | glm-4.6 | 任意 GLM 对话模型 |
apiVersion | 2023-06-01 | anthropic-version 请求头 |
maxTokens | 4096 | 单次搜索生成上限 |
maxUses | 3 | 单次请求搜索工具调用上限 |
回滚
dsh plugin --profile web remove dsh-web-search-zhipu
移除后若不重新指定 web.searchProvider,会自动回落到剩余唯一注册的 provider(内置 deepseek-official)。
English
A DeepSeek Harness web-search plugin that routes the web_search tool through Zhipu's (bigmodel) Anthropic-compatible endpoint, billing your existing GLM quota / Coding Plan instead of the DeepSeek platform. Ships a translation layer for Zhipu's non-standard tool_result response layout (plus standard Anthropic layout), with URL dedupe and citation-snippet joining. Zero-config with defaults; provider id glm-bigmodel.
dsh plugin --profile web add dsh-web-search-zhipu # then restart dsh web
开发
node test/unit.mjs # 解析器单测(真实响应回放 + 合成样例)
node test/e2e.mjs # 真实端点 e2e(读取 ~/.dsh/.credentials.yaml 的 ZAI key)