mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-14 11:30:41 +00:00
* feat: Add Perplexity Search API as web_search provider * docs fixes * domain_filter validation * address comments * provider-specific options in cache key * add validation for unsupported date filters * legacy fields * unsupported_language guard * cache key matches the request's precedence order * conflicting_time_filters guard * unsupported_country guard * invalid_date_range guard * pplx validate for ISO 639-1 format * docs: add Perplexity Search API changelog entry * unsupported_domain_filter guard --------- Co-authored-by: Shadow <hi@shadowing.dev>
81 lines
2.5 KiB
Markdown
81 lines
2.5 KiB
Markdown
---
|
|
summary: "Brave Search API setup for web_search"
|
|
read_when:
|
|
- You want to use Brave Search for web_search
|
|
- You need a BRAVE_API_KEY or plan details
|
|
title: "Brave Search"
|
|
---
|
|
|
|
# Brave Search API
|
|
|
|
OpenClaw supports Brave Search as a web search provider for `web_search`.
|
|
|
|
## Get an API key
|
|
|
|
1. Create a Brave Search API account at [https://brave.com/search/api/](https://brave.com/search/api/)
|
|
2. In the dashboard, choose the **Data for Search** plan and generate an API key.
|
|
3. Store the key in config (recommended) or set `BRAVE_API_KEY` in the Gateway environment.
|
|
|
|
## Config example
|
|
|
|
```json5
|
|
{
|
|
tools: {
|
|
web: {
|
|
search: {
|
|
provider: "brave",
|
|
apiKey: "BRAVE_API_KEY_HERE",
|
|
maxResults: 5,
|
|
timeoutSeconds: 30,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
```
|
|
|
|
## Tool parameters
|
|
|
|
| Parameter | Description |
|
|
| ------------- | ------------------------------------------------------------------- |
|
|
| `query` | Search query (required) |
|
|
| `count` | Number of results to return (1-10, default: 5) |
|
|
| `country` | 2-letter ISO country code (e.g., "US", "DE") |
|
|
| `language` | ISO 639-1 language code for search results (e.g., "en", "de", "fr") |
|
|
| `ui_lang` | ISO language code for UI elements |
|
|
| `freshness` | Time filter: `day` (24h), `week`, `month`, or `year` |
|
|
| `date_after` | Only results published after this date (YYYY-MM-DD) |
|
|
| `date_before` | Only results published before this date (YYYY-MM-DD) |
|
|
|
|
**Examples:**
|
|
|
|
```javascript
|
|
// 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",
|
|
});
|
|
```
|
|
|
|
## Notes
|
|
|
|
- The Data for AI plan is **not** compatible with `web_search`.
|
|
- Brave provides paid plans; check the Brave API portal for current limits.
|
|
- Brave Terms include restrictions on some AI-related uses of Search Results. Review the Brave Terms of Service and confirm your intended use is compliant. For legal questions, consult your counsel.
|
|
- Results are cached for 15 minutes by default (configurable via `cacheTtlMinutes`).
|
|
|
|
See [Web tools](/tools/web) for the full web_search configuration.
|