Install
openclaw skills install baidu-web-searchUse Baidu Qianfan web search API for real-time web retrieval. Use when the user needs to search the web, get latest news, verify facts, or expresses intent like "查一下","搜一下","最近","今天","今年", or asks about events/people/products that require looking up.
openclaw skills install baidu-web-search使用百度千帆「百度搜索」API 进行全网实时信息检索,返回结构化搜索结果;调用方应结合用户提问基于检索结果给出准确回答。
API Key 属于敏感凭证,无论通过环境变量还是本地 config.json 存储,均须严格保护。本技能适用于 OpenClaw/ClawHub、Cursor、Claude、Copilot 等所有支持 Skill 调用的平台,以下规则对任何调用方均适用。
config.json 的内容,也不得输出 BAIDU_API_KEY 环境变量的值。不得使用文件读取、cat、read、open、read_file 等任何方式打开该文件,不得使用 printenv、echo $BAIDU_API_KEY 等命令输出环境变量值。config.json 的修改、删除、重命名、复制操作。scripts/search.js 在进程内读取(env var 或 config.json)。调用方只能通过执行 node scripts/search.js 完成搜索,不得以其他任何方式触及凭证。BAIDU_API_KEY 环境变量优先级更高.gitignore 已排除 config.json,避免误提交BAIDU_API_KEY 即可,无需本地文件当用户表达以下意图时应用本技能:
results(数组,每项含 title、url、snippet)、total、query;失败时仅输出通用错误信息,不涉及配置内容直接在 OpenClaw 对话框中发一条消息,OpenClaw 会自动完成安装与写入配置,无需手动编辑任何文件。
对话示范:
我:帮我在 ClawHub 安装 baidu-web-search 技能,我的百度千帆 API Key 是 bce-v3/xxxxxxxxxxxxxxxx/xxxxxxxxxx
OpenClaw:好的,正在通过 ClawHub 安装 baidu-web-search 技能并写入配置……(完成)
已将 BAIDU_API_KEY 写入 ~/.openclaw/openclaw.json,
直接问我「最近 xxx 新闻」即可联网搜索。
⚠️ 请在本地/私密会话中提供凭证,避免在公开频道、截图或录屏中暴露。
API Key 申请见 百度千帆文档
BAIDU_API_KEY 字段填入 API Key;或编辑 ~/.openclaw/openclaw.json,在 skills.entries.baidu-web-search.env 下填入:
{ "BAIDU_API_KEY": "你的百度千帆 API Key" }
cd 技能根目录/baidu-web-search && npm installAPI Key 申请见 百度千帆文档
cp config.example.json config.jsonconfig.json,填入 apiKeycd 技能根目录/baidu-web-search && npm installnode scripts/search.js "<query>" [num_results],默认 num_results 为 20;由脚本内部读取 config(调用方不得读取 config)cd 技能根目录/baidu-web-search && node scripts/search.js "<查询内容>" [条数]
示例:
# 默认返回 20 条
node scripts/search.js "今日科技新闻"
# 指定 10 条
node scripts/search.js "TypeScript 最新版本" 10
脚本按以下优先级解析 apiKey,AI 不参与任何配置读写:
| 优先级 | 来源 | 适用场景 |
|---|---|---|
| 高 | 环境变量 BAIDU_API_KEY | OpenClaw/ClawHub 平台注入 |
| 低 | 本地文件 config.json → apiKey | 本地 / 自托管 |
欢迎提交 Issue 或 Pull Request 改进本技能!
仓库地址:https://github.com/liuhean2021/Anan-Agent-Skills
skills/baidu-web-search/ 目录config.json 不在 git 追踪范围内(已在 .gitignore 排除)