← 返回 Skills 市场
1404
总下载
0
收藏
9
当前安装
2
版本数
在 OpenClaw 中安装
/install baidu-search-openclaw
功能描述
使用百度 AI 搜索 API 进行 Web 搜索。优先使用 API 模式,配额不足时自动切换到浏览器模式。支持中文搜索、新闻搜索等功能。
使用说明 (SKILL.md)
百度搜索
使用百度 AI 搜索 API 或浏览器进行 Web 搜索。支持两种模式:
- API 模式 - 使用百度千帆 AI 搜索 API(优先)
- 浏览器模式 - 使用浏览器打开百度搜索页面
配置
环境变量
使用技能前需要设置百度千帆 API Key:
# Windows (PowerShell)
$env:BAIDU_API_KEY="your-api-key"
$env:PYTHONIOENCODING="utf-8"
# Linux/Mac
export BAIDU_API_KEY="your-api-key"
export PYTHONIOENCODING="utf-8"
API Key 获取地址:https://console.bce.baidu.com/qianfan/ais/console/apiKey
API 端点
- 端点:
https://qianfan.baidubce.com/v2/ai_search/web_search - 模型:百度千帆 AI 搜索
使用流程
- 首先尝试 API 模式(需要设置 BAIDU_API_KEY 环境变量)
- 如果 API 失败(配额不足等) → 切换到浏览器模式
API 模式
Python 脚本调用
# Windows
$env:PYTHONIOENCODING="utf-8"
python skills/baidu-search/scripts/search.py '{"query":"今日新闻"}'
# Linux/Mac
PYTHONIOENCODING=utf-8 python3 skills/baidu-search/scripts/search.py '{"query":"今日新闻"}'
请求参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| query | string | 是 | - | 搜索关键词 |
| edition | string | 否 | standard | standard(完整版) 或 lite(轻量版) |
| resource_type_filter | array | 否 | web:20 | 资源类型过滤 |
| search_filter | object | 否 | - | 高级过滤条件 |
| block_websites | array | 否 | - | 排除的网站列表 |
| search_recency_filter | string | 否 | year | 时间过滤:week, month, semiyear, year |
| safe_search | bool | 否 | false | 严格内容过滤 |
使用 exec 工具调用
# 先设置环境变量 (Windows)
$env:BAIDU_API_KEY = "your-api-key"
$env:PYTHONIOENCODING = "utf-8"
# 然后调用 API
$body = @{
messages = @(
@{content = "今日新闻"; role = "user"}
)
edition = "standard"
search_source = "baidu_search_v2"
resource_type_filter = @(
@{type = "web"; top_k = 10}
)
search_recency_filter = "week"
safe_search = $false
} | ConvertTo-Json -Depth 3
Invoke-RestMethod -Uri "https://qianfan.baidubce.com/v2/ai_search/web_search" `
-Method POST `
-Headers @{
"Authorization" = "Bearer $env:BAIDU_API_KEY"
"X-Appbuilder-From" = "openclaw"
"Content-Type" = "application/json"
} `
-Body $body
SearchFilter 高级过滤
{
"query": "最新新闻",
"search_recency_filter": "week",
"search_filter": {
"match": {
"site": ["news.baidu.com"]
}
}
}
资源类型过滤
{
"query": "旅游景点",
"resource_type_filter": [
{"type": "web", "top_k": 20},
{"type": "video", "top_k": 5}
]
}
浏览器模式
搜索 URL 格式
- 网页搜索:
https://www.baidu.com/s?wd=关键词 - 新闻搜索:
https://www.baidu.com/s?wd=关键词&tn=news
操作步骤
- 使用
browser工具的openaction 打开搜索 URL - 使用
browser工具的snapshotaction 获取搜索结果
注意事项
- API 配额:每用户有一定免费配额,用完需付费
- 环境变量:必须设置 BAIDU_API_KEY 才能使用 API 模式
- 自动降级:API 调用失败时自动切换到浏览器模式
- 中文支持:两种模式都完美支持中文搜索
安全使用建议
This skill appears to implement exactly what it promises: calling Baidu's Qianfan web_search API with a browser fallback. Before installing, confirm you trust the skill source (source/homepage are unknown) and be prepared to supply a valid BAIDU_API_KEY. Ensure Python and the 'requests' package are available in the environment (the script will fail otherwise). Review the small search.py file yourself if you want to confirm there is no additional behavior. Also note API quota/permissions for your BAIDU_API_KEY and that the agent may call the skill autonomously when invoked (normal behavior).
功能分析
Type: OpenClaw Skill
Name: baidu-search-openclaw
Version: 1.0.2
The skill is a legitimate implementation for performing web searches via the Baidu AI Search API. The Python script (scripts/search.py) correctly handles authentication using environment variables and communicates exclusively with the official Baidu endpoint (qianfan.baidubce.com). No evidence of data exfiltration, malicious execution, or prompt injection was found.
能力评估
Purpose & Capability
Name/description match the included Python script and instructions: both target Baidu Qianfan AI web_search. Required env var BAIDU_API_KEY is the expected credential for the described API.
Instruction Scope
SKILL.md and the script stay within the stated purpose (call Baidu API, fallback to browser). Minor imprecision: SKILL.md asks users to set PYTHONIOENCODING (used in invocation examples) even though the script doesn't read that variable. Otherwise no instructions ask for unrelated files, system state, or external endpoints.
Install Mechanism
No install spec (instruction-only) and the code file is small and readable. Operational note: the Python script uses the 'requests' library but the skill does not declare that dependency; callers must ensure 'requests' is installed. No downloads or obscure URLs are present.
Credentials
Only BAIDU_API_KEY (primary credential) and PYTHONIOENCODING are required; both are proportionate to a search API client. The script only reads BAIDU_API_KEY from the environment and does not request unrelated secrets or config paths.
Persistence & Privilege
Skill is not always-enabled and uses normal autonomous invocation settings. It does not modify other skills or system-wide configuration and requests no persistent privileges beyond reading its own env var.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install baidu-search-openclaw - 安装完成后,直接呼叫该 Skill 的名称或使用
/baidu-search-openclaw触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
- Added requirement for PYTHONIOENCODING environment variable to ensure correct encoding, especially for Windows.
- Updated configuration instructions to include PYTHONIOENCODING setup for both Windows and Linux/Mac.
- Adjusted script calling examples to reflect new environment variable usage.
- Metadata updated to require the PYTHONIOENCODING variable.
v1.0.0
- Initial release of baidu-search skill.
- Supports Web search using the Baidu AI Search API, with automatic fallback to browser mode when API quota is insufficient.
- Enables a full-featured search experience: supports Chinese language queries, news search, filtering, and safe search options.
- Usage instructions provided for both API mode (with environment variable setup) and browser mode.
- API and browser modes fully support Chinese search.
元数据
常见问题
百度搜索 是什么?
使用百度 AI 搜索 API 进行 Web 搜索。优先使用 API 模式,配额不足时自动切换到浏览器模式。支持中文搜索、新闻搜索等功能。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1404 次。
如何安装 百度搜索?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install baidu-search-openclaw」即可一键安装,无需额外配置。
百度搜索 是免费的吗?
是的,百度搜索 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
百度搜索 支持哪些平台?
百度搜索 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 百度搜索?
由 yhongm(@yhongm)开发并维护,当前版本 v1.0.2。
推荐 Skills