Local proxy that makes OpenClaw's Brave Search provider route to DuckDuckGo for free,
without any API key.
http://127.0.0.1:8000ddgs# Clone the repo
git clone https://github.com/asoraruf/brave_shim <clone-path>
# Create venv and install dependencies
python -m venv <clone-path>/venv
# Windows:
<clone-path>\venv\Scripts\activate
pip install fastapi uvicorn ddgs pyyaml
# Linux/Mac:
source <clone-path>/venv/bin/activate
pip install fastapi uvicorn ddgs pyyaml
The Brave provider in OpenClaw's bundled JS calls https://api.search.brave.com. Replace it with http://127.0.0.1:8000:
import subprocess, re, os
dist_dir = r"<openclaw-dist>"
pattern = r'(const BRAVE_SEARCH_ENDPOINT|const BRAVE_LLM_CONTEXT_ENDPOINT) = "[^"]+"'
replacement = {
"const BRAVE_SEARCH_ENDPOINT": 'const BRAVE_SEARCH_ENDPOINT = "http://127.0.0.1:8000/res/v1/web/search"',
"const BRAVE_LLM_CONTEXT_ENDPOINT": 'const BRAVE_LLM_CONTEXT_ENDPOINT = "http://127.0.0.1:8000/res/v1/llm/context"',
}
for fname in os.listdir(dist_dir):
if fname.startswith("brave-web-search-provider") and fname.endswith(".js"):
fpath = os.path.join(dist_dir, fname)
content = open(fpath).read()
new_content = re.sub(pattern, lambda m: replacement.get(m.group(1), m.group(0)), content)
open(fpath, "w").write(new_content)
# Enable brave plugin (disabled by default)
openclaw config set plugins.entries.brave.enabled true
# Set Brave as search provider
openclaw config set tools.web.search.provider brave
# Restart gateway
openclaw gateway restart
# From brave_shim directory
.\venv\Scripts\python brave_shim.py
# Keep running in background
curl "http://127.0.0.1:8000/res/v1/web/search?q=hello+world"
# Should return JSON with web results
openclaw
# Then test: web_search { query: "test" }
scripts/setup_brave_shim.py — Automated install: clone, venv, pip installscripts/patch_openclaw.py — Patch OpenClaw dist JS files to redirect Brave APIscripts/start_shim.py — Start brave_shim service"fetch failed" after setup:
Invoke-WebRequest http://127.0.0.1:8000/res/v1/web/search?q=testpython brave_shim.pyNO_PROXY=localhost,127.0.0.1"missing_brave_api_key" error:
plugins.entries.brave needs enabled: true — run openclaw config set plugins.entries.brave.enabled true"missing_gemini_api_key" instead:
openclaw doctor for disabled plugin warnings共 1 个版本