tools: add badiu as web search provider

This commit is contained in:
ideoutrea 2026-03-20 12:56:23 +08:00
parent 918df6c542
commit 8630650abf

View File

@ -11,7 +11,7 @@ title: "Web Tools"
OpenClaw ships two lightweight web tools:
- `web_search` — Search the web using Brave Search API, Firecrawl Search, Gemini with Google Search grounding, Grok, Kimi, or Perplexity Search API.
- `web_search` — Search the web using Baidu Search API, Brave Search API, Firecrawl Search, Gemini with Google Search grounding, Grok, Kimi, or Perplexity Search API.
- `web_fetch` — HTTP fetch + readable extraction (HTML → markdown/text).
These are **not** browser automation. For JS-heavy sites or logins, use the
@ -32,6 +32,7 @@ See [Brave Search setup](/tools/brave-search) and [Perplexity Search setup](/too
| Provider | Result shape | Provider-specific filters | Notes | API key |
| ------------------------- | ---------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------- |
| **Baidu** | Structured results with snippets | — | Uses Baidu Search | `BAIDU_SEARCH_API_KEY` |
| **Brave Search API** | Structured results with snippets | `country`, `language`, `ui_lang`, time | Supports Brave `llm-context` mode | `BRAVE_API_KEY` |
| **Firecrawl Search** | Structured results with snippets | Use `firecrawl_search` for Firecrawl-specific search options | Best for pairing search with Firecrawl scraping/extraction | `FIRECRAWL_API_KEY` |
| **Gemini** | AI-synthesized answers + citations | — | Uses Google Search grounding | `GEMINI_API_KEY` |
@ -43,12 +44,13 @@ See [Brave Search setup](/tools/brave-search) and [Perplexity Search setup](/too
The table above is alphabetical. If no `provider` is explicitly set, runtime auto-detection checks providers in this order:
1. **Brave**`BRAVE_API_KEY` env var or `plugins.entries.brave.config.webSearch.apiKey`
2. **Gemini**`GEMINI_API_KEY` env var or `plugins.entries.google.config.webSearch.apiKey`
3. **Grok**`XAI_API_KEY` env var or `plugins.entries.xai.config.webSearch.apiKey`
4. **Kimi**`KIMI_API_KEY` / `MOONSHOT_API_KEY` env var or `plugins.entries.moonshot.config.webSearch.apiKey`
5. **Perplexity**`PERPLEXITY_API_KEY`, `OPENROUTER_API_KEY`, or `plugins.entries.perplexity.config.webSearch.apiKey`
6. **Firecrawl**`FIRECRAWL_API_KEY` env var or `plugins.entries.firecrawl.config.webSearch.apiKey`
1. **Baidu**`BAIDU_SEARCH_API_KEY` env var or `plugins.entries.baidu.config.webSearch.apiKey`
2. **Brave**`BRAVE_API_KEY` env var or `plugins.entries.brave.config.webSearch.apiKey`
3. **Gemini**`GEMINI_API_KEY` env var or `plugins.entries.google.config.webSearch.apiKey`
4. **Grok**`XAI_API_KEY` env var or `plugins.entries.xai.config.webSearch.apiKey`
5. **Kimi**`KIMI_API_KEY` / `MOONSHOT_API_KEY` env var or `plugins.entries.moonshot.config.webSearch.apiKey`
6. **Perplexity**`PERPLEXITY_API_KEY`, `OPENROUTER_API_KEY`, or `plugins.entries.perplexity.config.webSearch.apiKey`
7. **Firecrawl**`FIRECRAWL_API_KEY` env var or `plugins.entries.firecrawl.config.webSearch.apiKey`
If no keys are found, it falls back to Brave (you'll get a missing-key error prompting you to configure one).
@ -62,6 +64,12 @@ Runtime SecretRef behavior:
Use `openclaw configure --section web` to set up your API key and choose a provider.
### Baidu Search
1. Visit the [Baidu AI Search Console](https://console.bce.baidu.com/ai-search/qianfan/ais/console/apiKey)
2. Generate a new API key or select an existing one(format: `bce-v3/ALTAK-...`)
3. Copy the API key and use it with OpenClaw
### Brave Search
1. Create a Brave Search API account at [brave.com/search/api](https://brave.com/search/api/)
@ -91,6 +99,7 @@ See [Perplexity Search API Docs](https://docs.perplexity.ai/guides/search-quicks
**Via config:** run `openclaw configure --section web`. It stores the key under the provider-specific config path:
- Baidu: `plugins.entries.baidu.config.webSearch.apiKey`
- Brave: `plugins.entries.brave.config.webSearch.apiKey`
- Firecrawl: `plugins.entries.firecrawl.config.webSearch.apiKey`
- Gemini: `plugins.entries.google.config.webSearch.apiKey`
@ -102,6 +111,7 @@ All of these fields also support SecretRef objects.
**Via environment:** set provider env vars in the Gateway process environment:
- Baidu: `BAIDU_SEARCH_API_KEY`
- Brave: `BRAVE_API_KEY`
- Firecrawl: `FIRECRAWL_API_KEY`
- Gemini: `GEMINI_API_KEY`
@ -113,6 +123,32 @@ For a gateway install, put these in `~/.openclaw/.env` (or your service environm
### Config examples
**Baidu Search:**
```json5
{
plugins: {
entries: {
baidu: {
config: {
webSearch: {
apiKey: "YOUR_BAIDU_API_KEY", // optional if BRAVE_API_KEY is set // pragma: allowlist secret
},
},
},
},
},
tools: {
web: {
search: {
enabled: true,
provider: "baidu",
},
},
},
}
```
**Brave Search:**
```json5
@ -320,6 +356,7 @@ Search the web using your configured provider.
- `tools.web.search.enabled` must not be `false` (default: enabled)
- API key for your chosen provider:
- **Baidu**: `BAIDU_SEARCH_API_KEY` or `plugins.entries.baidu.config.webSearch.apiKey`
- **Brave**: `BRAVE_API_KEY` or `plugins.entries.brave.config.webSearch.apiKey`
- **Firecrawl**: `FIRECRAWL_API_KEY` or `plugins.entries.firecrawl.config.webSearch.apiKey`
- **Gemini**: `GEMINI_API_KEY` or `plugins.entries.google.config.webSearch.apiKey`