docs/tools/brave-search.md
OpenClaw supports Brave Search API as a web_search provider.
BRAVE_API_KEY in the Gateway environment.{
plugins: {
entries: {
brave: {
config: {
webSearch: {
apiKey: "BRAVE_API_KEY_HERE",
mode: "web", // or "llm-context"
baseUrl: "https://api.search.brave.com", // optional proxy/base URL override
},
},
},
},
},
tools: {
web: {
search: {
provider: "brave",
maxResults: 5,
timeoutSeconds: 30,
},
},
},
}
Provider-specific Brave search settings now live under plugins.entries.brave.config.webSearch.*.
Legacy tools.web.search.apiKey still loads through the compatibility shim, but it is no longer the canonical config path.
webSearch.mode controls the Brave transport:
web (default): normal Brave web search with titles, URLs, and snippetsllm-context: Brave LLM Context API with pre-extracted text chunks and sources for groundingwebSearch.baseUrl can point Brave requests at a trusted Brave-compatible proxy
or gateway. OpenClaw appends /res/v1/web/search or /res/v1/llm/context to
the configured base URL and keeps the base URL in the cache key. Public
endpoints must use https://; http:// is accepted only for trusted loopback
or private-network proxy hosts.
Examples:
// Country and language-specific search
await web_search({
query: "renewable energy",
country: "DE",
language: "de",
});
// Recent results (past week)
await web_search({
query: "AI news",
freshness: "week",
});
// Date range search
await web_search({
query: "AI developments",
date_after: "2024-01-01",
date_before: "2024-06-30",
});
llm-context mode returns grounded source entries instead of the normal web-search snippet shape.llm-context mode supports freshness and bounded date_after + date_before ranges. It does not support ui_lang; date_before without date_after is rejected because Brave requires custom freshness ranges to include both start and end dates.ui_lang must include a region subtag like en-US.cacheTtlMinutes).webSearch.baseUrl values are included in Brave cache identity, so
proxy-specific responses do not collide.brave.http diagnostics flag to log Brave request URLs/query params, response status/timing, and search-cache hit/miss/write events while troubleshooting. The flag never logs the API key or response bodies, but search queries can be sensitive.