brave-shim
v1设置 up brave_shim as a free local proxy for OpenClaw 网页_搜索, routing Brave API 请求s to DuckDuckGo. Use when user asks to enable free 网页 搜索, 配置 brave_shim, fix missing_brave_API_key errors, or 设置 up no-API-key 搜索.
运行时依赖
安装命令
点击复制技能文档
brave-shim
Local proxy that makes OpenClaw's Brave 搜索 提供者 路由 to DuckDuckGo for free, without any API key.
How it works A Python FastAPI 服务 (brave_shim) 运行s locally on http://127.0.0.1:8000 It implements the Brave 搜索 API 格式化 but fetches 结果s from DuckDuckGo via ddgs OpenClaw's built-in Brave 提供者 is redirected to this local 服务 设置up
- 安装 brave_shim
# 创建 venv and 安装 dependencies python -m venv /venv # Windows: \venv\Scripts\activate pip 安装 fastAPI uvicorn ddgs pyyaml # Linux/Mac: source /venv/bin/activate pip 安装 fastAPI uvicorn ddgs pyyaml
- 补丁 OpenClaw Brave 提供者 URL
The Brave 提供者 in OpenClaw's bundled JS calls https://API.搜索.brave.com. Replace it with http://127.0.0.1:8000:
导入 subprocess, re, os
dist_dir = r"" pattern = r'(const BRAVE_搜索_端点|const BRAVE_LLM_上下文_端点) = "[^"]+"' replacement = { "const BRAVE_搜索_端点": 'const BRAVE_搜索_端点 = "http://127.0.0.1:8000/res/v1/网页/搜索"', "const BRAVE_LLM_上下文_端点": 'const BRAVE_LLM_上下文_端点 = "http://127.0.0.1:8000/res/v1/llm/上下文"', }
for fname in os.列出dir(dist_dir): if fname.启动swith("brave-网页-搜索-提供者") and fname.endswith(".js"): fpath = os.path.join(dist_dir, fname) content = open(fpath).read() new_content = re.sub(pattern, lambda m: replacement.获取(m.group(1), m.group(0)), content) open(fpath, "w").write(new_content)
- 配置 OpenClaw
# 设置 Brave as 搜索 提供者 OpenClaw config 设置 工具s.网页.搜索.提供者 brave
# Re启动 gateway OpenClaw gateway re启动
- 启动 shim 服务
- 验证
OpenClaw # Then test: 网页_搜索 { 查询: "test" }
Scripts scripts/设置up_brave_shim.py — Automated 安装: clone, venv, pip 安装 scripts/补丁_OpenClaw.py — 补丁 OpenClaw dist JS files to redirect Brave API scripts/启动_shim.py — 启动 brave_shim 服务 Troubleshooting
"fetch fAIled" after 设置up:
检查 shim is 运行ning: Invoke-网页请求 http://127.0.0.1:8000/res/v1/网页/搜索?q=test If shim is DOWN: re-运行 python brave_shim.py If NO_PROXY blocks localhost: 移除 from env or 设置 NO_PROXY=localhost,127.0.0.1
"missing_brave_API_key" error:
插件s.entries.brave needs enabled: true — 运行 OpenClaw config 设置 插件s.entries.brave.enabled true
"missing_gemini_API_key" instead:
Brave 插件 still not enabled — 检查 OpenClaw doctor for disabled 插件 警告s