Bocha Search Skill for OpenClaw
🔍 博查AI搜索 - 专为中文内容优化的智能搜索工具
Overview
This skill provides web search capabilities through the Bocha AI Search API (博查AI搜索). It's particularly effective for:
- - ✅ Chinese language searches (中文搜索)
- ✅ Domestic Chinese content (国内内容)
- ✅ News and current events (新闻资讯)
- ✅ Encyclopedia and knowledge queries (百科知识)
- ✅ High-quality AI-generated summaries (AI智能摘要)
Requirements
- - API Key: You need a Bocha API key from https://open.bocha.cn/
- Node.js: Required to run the search script
- Environment Variable: Set
BOCHA_API_KEY or configure via OpenClaw settings
Configuration
Step 1: Get API Key
- 1. Visit 博查AI开放平台
- Register an account (注册账号)
- Create an application and get your API KEY
- Recharge if needed (充值以获得搜索额度)
Step 2: Configure OpenClaw
Add to ~/.openclaw/openclaw.json:
CODEBLOCK0
Or set environment variable:
CODEBLOCK1
Usage
Once configured, you can use this skill by asking in Chinese or English:
CODEBLOCK2
The skill will automatically route Chinese queries or explicit "bocha" / "博查" / "search" requests to this search provider.
Features
| Feature | Description |
|---|
| Chinese Optimized | Better results for Chinese language queries |
| High-Quality Summaries |
AI-generated article summaries (when
summary: true) |
|
Multi-Modal | Returns web pages, images, and related content |
|
Time Filtering | Filter results by time range (day/week/month/year) |
|
Fast Response | Typically returns results within 1-2 seconds |
|
Rich Metadata | Includes publish date, site name, favicon, etc. |
API Parameters
When calling the underlying tool directly:
| Parameter | Type | Required | Default | Description |
|---|
| INLINECODE3 | string | ✅ Yes | - | Search query (supports Chinese and English) |
| INLINECODE4 |
number | No | 10 | Number of results (1-50) |
|
freshness | string | No | "noLimit" | Time filter: "oneDay", "oneWeek", "oneMonth", "oneYear", "noLimit" |
|
summary | boolean | No | true | Whether to include AI-generated summaries |
Example Tool Call
CODEBLOCK3
Response Format
The API returns structured data including:
- - Web Pages: Title, URL, snippet, summary, site name, publish date
- Images: Thumbnail URL, full image URL, dimensions
- Total Matches: Estimated total number of matching results
- Related Queries: Suggested related search terms
Sample Response Structure
CODEBLOCK4
Error Handling
Common errors and solutions:
| Error | Cause | Solution |
|---|
| INLINECODE7 | API key not configured | Add API key to config or environment |
| INLINECODE8 |
Wrong API key | Check your API key at https://open.bocha.cn/ |
|
Insufficient balance | Out of credits | Recharge your account |
|
Rate limit exceeded | Too many requests | Wait before making more requests |
Pricing
- - Visit https://open.bocha.cn/pricing for current pricing
- New users typically get free credits to start
- Pay-as-you-go based on search volume
Technical Details
API Endpoint
- - URL: INLINECODE11
- Method: POST
- Auth: Bearer token in Authorization header
Script Location
CODEBLOCK5
Comparison with Other Search Tools
| Feature | Bocha Search | Brave Search | Perplexity |
|---|
| Chinese Content | ⭐⭐⭐ Excellent | ⭐⭐ Good | ⭐⭐ Good |
| Speed |
⭐⭐⭐ Fast | ⭐⭐⭐ Fast | ⭐⭐ Moderate |
| Summaries | ⭐⭐⭐ AI-powered | ❌ No | ⭐⭐⭐ AI-powered |
| Images | ⭐⭐⭐ Included | ⭐⭐ Separate | ⭐ Limited |
| Pricing | 💰 Affordable | 🆓 Free tier | 💰 Moderate |
Best Practices
- 1. Use Chinese queries for better Chinese content results
- Enable summaries (
summary: true) for better context - Set appropriate freshness based on your needs:
- Breaking news:
"oneDay"
- Recent developments:
"oneWeek"
- General research:
"noLimit"
- 4. Start with count=10, increase if needed (max 50)
- Handle rate limits gracefully in production use
Troubleshooting
No results returned
- - Try different keywords or synonyms
- Remove time restrictions (
freshness: "noLimit") - Check if your query is too specific
Slow response
- - Reduce
count parameter - Disable summaries if not needed (
summary: false) - Check network connectivity to INLINECODE19
API errors
- - Verify API key is correct and active
- Check account balance at https://open.bocha.cn/
- Ensure you're not exceeding rate limits
Links
License
MIT License - See LICENSE file for details
Note: This skill is specifically designed for OpenClaw and uses the official Bocha AI Search API. It is not affiliated with or endorsed by Bocha AI.
OpenClaw 的博查搜索技能
🔍 博查AI搜索 - 专为中文内容优化的智能搜索工具
概述
该技能通过博查AI搜索API提供网页搜索能力。特别适用于:
- - ✅ 中文语言搜索
- ✅ 国内中文内容
- ✅ 新闻资讯
- ✅ 百科知识
- ✅ AI智能摘要
要求
- - API密钥:需要从 https://open.bocha.cn/ 获取博查API密钥
- Node.js:运行搜索脚本所需
- 环境变量:设置BOCHAAPIKEY或通过OpenClaw设置配置
配置
步骤1:获取API密钥
- 1. 访问博查AI开放平台
- 注册账号
- 创建应用并获取API密钥
- 如有需要,充值以获得搜索额度
步骤2:配置OpenClaw
添加到~/.openclaw/openclaw.json:
json
{
skills: {
entries: {
bocha-search: {
enabled: true,
apiKey: your-bocha-api-key-here,
env: {
BOCHAAPIKEY: your-bocha-api-key-here
}
}
}
}
}
或者设置环境变量:
bash
export BOCHAAPIKEY=your-bocha-api-key-here
使用方法
配置完成后,您可以通过中文或英文提问来使用此技能:
搜索北京今天的天气
用博查查找人工智能的最新进展
bocha search: 量子计算发展趋势
查找特朗普的最新新闻
该技能会自动将中文查询或明确包含bocha/博查/search的请求路由到此搜索提供商。
功能特性
AI生成的文章摘要(当summary: true时) |
|
多模态 | 返回网页、图片和相关内容 |
|
时间筛选 | 按时间范围筛选结果(天/周/月/年) |
|
快速响应 | 通常在1-2秒内返回结果 |
|
丰富元数据 | 包含发布日期、站点名称、网站图标等 |
API参数
直接调用底层工具时:
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|
| query | 字符串 | ✅ 是 | - | 搜索查询(支持中文和英文) |
| count |
数字 | 否 | 10 | 结果数量(1-50) |
| freshness | 字符串 | 否 | noLimit | 时间筛选:oneDay、oneWeek、oneMonth、oneYear、noLimit |
| summary | 布尔值 | 否 | true | 是否包含AI生成的摘要 |
工具调用示例
javascript
// 搜索中文AI最新新闻
{
query: 人工智能最新进展,
count: 10,
freshness: oneWeek,
summary: true
}
// 搜索特朗普新闻
{
query: 特朗普 Trump 最新新闻,
count: 5,
freshness: oneDay
}
响应格式
API返回结构化数据,包括:
- - 网页:标题、URL、摘要、总结、站点名称、发布日期
- 图片:缩略图URL、完整图片URL、尺寸
- 总匹配数:估计的匹配结果总数
- 相关查询:建议的相关搜索词
示例响应结构
json
{
_type: SearchResponse,
queryContext: {
originalQuery: search term
},
webPages: {
totalEstimatedMatches: 1908646,
value: [
{
name: 文章标题,
url: https://example.com/article,
snippet: 简短描述...,
summary: 完整的AI生成摘要...,
siteName: 示例站点,
datePublished: 2026-01-30T07:19:14+08:00
}
]
},
images: {
value: [...]
}
}
错误处理
常见错误及解决方案:
| 错误 | 原因 | 解决方案 |
|---|
| BOCHAAPIKEY is required | 未配置API密钥 | 在配置或环境中添加API密钥 |
| Invalid API KEY |
API密钥错误 | 在https://open.bocha.cn/检查您的API密钥 |
| Insufficient balance | 余额不足 | 充值您的账户 |
| Rate limit exceeded | 请求过多 | 等待后再发起更多请求 |
定价
- - 访问 https://open.bocha.cn/pricing 查看当前定价
- 新用户通常可获得免费额度
- 按搜索量付费
技术细节
API端点
- - URL:https://api.bocha.cn/v1/web-search
- 方法:POST
- 认证:Authorization头中的Bearer令牌
脚本位置
skills/bocha-search/
├── SKILL.md # 本文件
├── README.md # 完整文档
├── LICENSE # MIT许可证
└── scripts/
├── package.json # Node.js配置
├── tool.json # OpenClaw工具定义
└── bocha_search.js # 主搜索脚本 ⬅️ 入口点
与其他搜索工具对比
| 功能 | 博查搜索 | Brave搜索 | Perplexity |
|---|
| 中文内容 | ⭐⭐⭐ 优秀 | ⭐⭐ 良好 | ⭐⭐ 良好 |
| 速度 |
⭐⭐⭐ 快速 | ⭐⭐⭐ 快速 | ⭐⭐ 中等 |
| 摘要 | ⭐⭐⭐ AI驱动 | ❌ 无 | ⭐⭐⭐ AI驱动 |
| 图片 | ⭐⭐⭐ 包含 | ⭐⭐ 独立 | ⭐ 有限 |
| 定价 | 💰 实惠 | 🆓 免费额度 | 💰 中等 |
最佳实践
- 1. 使用中文查询以获得更好的中文内容结果
- 启用摘要(summary: true)以获得更好的上下文
- 根据需求设置合适的新鲜度:
- 突发新闻:oneDay
- 最新进展:oneWeek
- 一般研究:noLimit
- 4. 从count=10开始,如需增加(最多50)
- 在生产使用中优雅处理速率限制
故障排除
无结果返回
- - 尝试不同的关键词或同义词
- 移除时间限制(freshness: noLimit)
- 检查查询是否过于具体
响应慢
- - 减少count参数
- 如不需要摘要则禁用它(summary: false)
- 检查到api.bocha.cn的网络连接
API错误
- - 验证API密钥是否正确且有效
- 在https://open.bocha.cn/检查账户余额
- 确保未超过速率限制
链接
许可证
MIT许可证 - 详见LICENSE文件
注意:此技能专为OpenClaw设计,使用官方博查AI搜索API。与博查AI无关联或背书关系。