运行时依赖
安装命令
点击复制技能文档
博查搜索 (Bocha 搜索)
基于博查 AI 搜索 API 的网页搜索插件,返回结构化的搜索结果,适合大模型使用。
功能特点 🔍 全网搜索,结果准确 📝 可选返回网页摘要 (summary) ⏰ 支持时间范围过滤 🌐 响应 格式兼容 Bing 搜索 API 配置 方式一:配置文件 (推荐)
编辑 config.json:
{ "APIKey": "sk-your-API-key" }
方式二:环境变量 导出 BOCHA_API_KEY="sk-your-API-key"
API Key 获取:https://open.bochaAI.com → API KEY 管理
使用方法 node scripts/搜索.js <查询> [options]
参数说明 参数 类型 必填 说明 <查询> string ✅ 搜索关键词 --count number ❌ 返回结果数量,范围 1-50,默认 10 --freshness string ❌ 时间范围过滤,默认 noLimit --summary flag ❌ 是否返回网页摘要 freshness 取值说明 值 说明 noLimit 不限时间 (默认,推荐) oneDay 一天内 oneWeek 一周内 oneMonth 一个月内 oneYear 一年内 YYYY-MM-DD..YYYY-MM-DD 自定义日期范围,如 2025-01-01..2025-04-06 YYYY-MM-DD 指定日期,如 2025-04-06
⚠️ 推荐使用 noLimit,搜索算法会自动优化时间范围。指定时间范围可能导致无结果。
示例 基本搜索 node scripts/搜索.js "沪电股份"
限制数量 node scripts/搜索.js "人工智能" --count 5
带摘要 node scripts/搜索.js "DeepSeek" --summary
限定时间范围 node scripts/搜索.js "AI新闻" --freshness oneWeek --count 10
组合使用 node scripts/搜索.js "阿里巴巴ESG报告" --count 5 --freshness oneMonth --summary
输出格式 成功响应 { "type": "搜索", "查询": "搜索词", "total结果s": 12345, "结果Count": 10, "结果s": [ { "索引": 1, "title": "网页标题", "url": "https://example.com/page", "description": "网页内容的简短描述", "summary": "网页内容的详细摘要 (需 --summary)", "siteName": "网站名称", "publishedDate": "2025-01-01T12:00:00+08:00" } ] }
错误响应 { "type": "error", "code": "401", "message": "Invalid API KEY", "记录_id": "xxxx" }
常见错误码 错误码 说明 处理方式 400 参数缺失 检查 查询 参数 401 API Key 无效 检查 config.json 或环境变量 403 余额不足 前往 open.bochaAI.com 充值 429 请求频率限制 稍后重试 API 文档 博查开放平台:https://open.bochaAI.com API 文档:https://bocha-AI.feishu.cn/wiki/RXEOw02rFiwzGSkd9mUcqoeAnNK