← Back to Skills Marketplace
1404
Downloads
0
Stars
9
Active Installs
2
Versions
Install in OpenClaw
/install baidu-search-openclaw
Description
使用百度 AI 搜索 API 进行 Web 搜索。优先使用 API 模式,配额不足时自动切换到浏览器模式。支持中文搜索、新闻搜索等功能。
README (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 调用失败时自动切换到浏览器模式
- 中文支持:两种模式都完美支持中文搜索
Usage Guidance
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).
Capability Analysis
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.
Capability Assessment
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.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install baidu-search-openclaw - After installation, invoke the skill by name or use
/baidu-search-openclaw - Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Frequently Asked Questions
What is 百度搜索?
使用百度 AI 搜索 API 进行 Web 搜索。优先使用 API 模式,配额不足时自动切换到浏览器模式。支持中文搜索、新闻搜索等功能。 It is an AI Agent Skill for Claude Code / OpenClaw, with 1404 downloads so far.
How do I install 百度搜索?
Run "/install baidu-search-openclaw" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is 百度搜索 free?
Yes, 百度搜索 is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does 百度搜索 support?
百度搜索 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created 百度搜索?
It is built and maintained by yhongm (@yhongm); the current version is v1.0.2.
More Skills