{ "title": "Web tools", "content": "OpenClaw ships two lightweight web tools:\n\n* `web_search` — Search the web via Brave Search API (default) or Perplexity Sonar (direct or via OpenRouter).\n* `web_fetch` — HTTP fetch + readable extraction (HTML → markdown/text).\n\nThese are **not** browser automation. For JS-heavy sites or logins, use the\n[Browser tool](/tools/browser).\n\n* `web_search` calls your configured provider and returns results.\n * **Brave** (default): returns structured results (title, URL, snippet).\n * **Perplexity**: returns AI-synthesized answers with citations from real-time web search.\n* Results are cached by query for 15 minutes (configurable).\n* `web_fetch` does a plain HTTP GET and extracts readable content\n (HTML → markdown/text). It does **not** execute JavaScript.\n* `web_fetch` is enabled by default (unless explicitly disabled).\n\n## Choosing a search provider\n\n| Provider | Pros | Cons | API Key |\n| ------------------- | -------------------------------------------- | ---------------------------------------- | -------------------------------------------- |\n| **Brave** (default) | Fast, structured results, free tier | Traditional search results | `BRAVE_API_KEY` |\n| **Perplexity** | AI-synthesized answers, citations, real-time | Requires Perplexity or OpenRouter access | `OPENROUTER_API_KEY` or `PERPLEXITY_API_KEY` |\n\nSee [Brave Search setup](/brave-search) and [Perplexity Sonar](/perplexity) for provider-specific details.\n\nSet the provider in config:\n\nExample: switch to Perplexity Sonar (direct API):\n\n## Getting a Brave API key\n\n1. Create a Brave Search API account at [https://brave.com/search/api/](https://brave.com/search/api/)\n2. In the dashboard, choose the **Data for Search** plan (not “Data for AI”) and generate an API key.\n3. Run `openclaw configure --section web` to store the key in config (recommended), or set `BRAVE_API_KEY` in your environment.\n\nBrave provides a free tier plus paid plans; check the Brave API portal for the\ncurrent limits and pricing.\n\n### Where to set the key (recommended)\n\n**Recommended:** run `openclaw configure --section web`. It stores the key in\n`~/.openclaw/openclaw.json` under `tools.web.search.apiKey`.\n\n**Environment alternative:** set `BRAVE_API_KEY` in the Gateway process\nenvironment. For a gateway install, put it in `~/.openclaw/.env` (or your\nservice environment). See [Env vars](/help/faq#how-does-openclaw-load-environment-variables).\n\n## Using Perplexity (direct or via OpenRouter)\n\nPerplexity Sonar models have built-in web search capabilities and return AI-synthesized\nanswers with citations. You can use them via OpenRouter (no credit card required - supports\ncrypto/prepaid).\n\n### Getting an OpenRouter API key\n\n1. Create an account at [https://openrouter.ai/](https://openrouter.ai/)\n2. Add credits (supports crypto, prepaid, or credit card)\n3. Generate an API key in your account settings\n\n### Setting up Perplexity search\n\n**Environment alternative:** set `OPENROUTER_API_KEY` or `PERPLEXITY_API_KEY` in the Gateway\nenvironment. For a gateway install, put it in `~/.openclaw/.env`.\n\nIf no base URL is set, OpenClaw chooses a default based on the API key source:\n\n* `PERPLEXITY_API_KEY` or `pplx-...` → `https://api.perplexity.ai`\n* `OPENROUTER_API_KEY` or `sk-or-...` → `https://openrouter.ai/api/v1`\n* Unknown key formats → OpenRouter (safe fallback)\n\n### Available Perplexity models\n\n| Model | Description | Best for |\n| -------------------------------- | ------------------------------------ | ----------------- |\n| `perplexity/sonar` | Fast Q\\&A with web search | Quick lookups |\n| `perplexity/sonar-pro` (default) | Multi-step reasoning with web search | Complex questions |\n| `perplexity/sonar-reasoning-pro` | Chain-of-thought analysis | Deep research |\n\nSearch the web using your configured provider.\n\n* `tools.web.search.enabled` must not be `false` (default: enabled)\n* API key for your chosen provider:\n * **Brave**: `BRAVE_API_KEY` or `tools.web.search.apiKey`\n * **Perplexity**: `OPENROUTER_API_KEY`, `PERPLEXITY_API_KEY`, or `tools.web.search.perplexity.apiKey`\n\n* `query` (required)\n* `count` (1–10; default from config)\n* `country` (optional): 2-letter country code for region-specific results (e.g., \"DE\", \"US\", \"ALL\"). If omitted, Brave chooses its default region.\n* `search_lang` (optional): ISO language code for search results (e.g., \"de\", \"en\", \"fr\")\n* `ui_lang` (optional): ISO language code for UI elements\n* `freshness` (optional, Brave only): filter by discovery time (`pd`, `pw`, `pm`, `py`, or `YYYY-MM-DDtoYYYY-MM-DD`)\n\nFetch a URL and extract readable content.\n\n* `tools.web.fetch.enabled` must not be `false` (default: enabled)\n* Optional Firecrawl fallback: set `tools.web.fetch.firecrawl.apiKey` or `FIRECRAWL_API_KEY`.\n\n* `url` (required, http/https only)\n* `extractMode` (`markdown` | `text`)\n* `maxChars` (truncate long pages)\n\n* `web_fetch` uses Readability (main-content extraction) first, then Firecrawl (if configured). If both fail, the tool returns an error.\n* Firecrawl requests use bot-circumvention mode and cache results by default.\n* `web_fetch` sends a Chrome-like User-Agent and `Accept-Language` by default; override `userAgent` if needed.\n* `web_fetch` blocks private/internal hostnames and re-checks redirects (limit with `maxRedirects`).\n* `maxChars` is clamped to `tools.web.fetch.maxCharsCap`.\n* `web_fetch` is best-effort extraction; some sites will need the browser tool.\n* See [Firecrawl](/tools/firecrawl) for key setup and service details.\n* Responses are cached (default 15 minutes) to reduce repeated fetches.\n* If you use tool profiles/allowlists, add `web_search`/`web_fetch` or `group:web`.\n* If the Brave key is missing, `web_search` returns a short setup hint with a docs link.", "code_samples": [ { "code": "Example: switch to Perplexity Sonar (direct API):", "language": "unknown" }, { "code": "## Getting a Brave API key\n\n1. Create a Brave Search API account at [https://brave.com/search/api/](https://brave.com/search/api/)\n2. In the dashboard, choose the **Data for Search** plan (not “Data for AI”) and generate an API key.\n3. Run `openclaw configure --section web` to store the key in config (recommended), or set `BRAVE_API_KEY` in your environment.\n\nBrave provides a free tier plus paid plans; check the Brave API portal for the\ncurrent limits and pricing.\n\n### Where to set the key (recommended)\n\n**Recommended:** run `openclaw configure --section web`. It stores the key in\n`~/.openclaw/openclaw.json` under `tools.web.search.apiKey`.\n\n**Environment alternative:** set `BRAVE_API_KEY` in the Gateway process\nenvironment. For a gateway install, put it in `~/.openclaw/.env` (or your\nservice environment). See [Env vars](/help/faq#how-does-openclaw-load-environment-variables).\n\n## Using Perplexity (direct or via OpenRouter)\n\nPerplexity Sonar models have built-in web search capabilities and return AI-synthesized\nanswers with citations. You can use them via OpenRouter (no credit card required - supports\ncrypto/prepaid).\n\n### Getting an OpenRouter API key\n\n1. Create an account at [https://openrouter.ai/](https://openrouter.ai/)\n2. Add credits (supports crypto, prepaid, or credit card)\n3. Generate an API key in your account settings\n\n### Setting up Perplexity search", "language": "unknown" }, { "code": "**Environment alternative:** set `OPENROUTER_API_KEY` or `PERPLEXITY_API_KEY` in the Gateway\nenvironment. For a gateway install, put it in `~/.openclaw/.env`.\n\nIf no base URL is set, OpenClaw chooses a default based on the API key source:\n\n* `PERPLEXITY_API_KEY` or `pplx-...` → `https://api.perplexity.ai`\n* `OPENROUTER_API_KEY` or `sk-or-...` → `https://openrouter.ai/api/v1`\n* Unknown key formats → OpenRouter (safe fallback)\n\n### Available Perplexity models\n\n| Model | Description | Best for |\n| -------------------------------- | ------------------------------------ | ----------------- |\n| `perplexity/sonar` | Fast Q\\&A with web search | Quick lookups |\n| `perplexity/sonar-pro` (default) | Multi-step reasoning with web search | Complex questions |\n| `perplexity/sonar-reasoning-pro` | Chain-of-thought analysis | Deep research |\n\n## web\\_search\n\nSearch the web using your configured provider.\n\n### Requirements\n\n* `tools.web.search.enabled` must not be `false` (default: enabled)\n* API key for your chosen provider:\n * **Brave**: `BRAVE_API_KEY` or `tools.web.search.apiKey`\n * **Perplexity**: `OPENROUTER_API_KEY`, `PERPLEXITY_API_KEY`, or `tools.web.search.perplexity.apiKey`\n\n### Config", "language": "unknown" }, { "code": "### Tool parameters\n\n* `query` (required)\n* `count` (1–10; default from config)\n* `country` (optional): 2-letter country code for region-specific results (e.g., \"DE\", \"US\", \"ALL\"). If omitted, Brave chooses its default region.\n* `search_lang` (optional): ISO language code for search results (e.g., \"de\", \"en\", \"fr\")\n* `ui_lang` (optional): ISO language code for UI elements\n* `freshness` (optional, Brave only): filter by discovery time (`pd`, `pw`, `pm`, `py`, or `YYYY-MM-DDtoYYYY-MM-DD`)\n\n**Examples:**", "language": "unknown" }, { "code": "## web\\_fetch\n\nFetch a URL and extract readable content.\n\n### Requirements\n\n* `tools.web.fetch.enabled` must not be `false` (default: enabled)\n* Optional Firecrawl fallback: set `tools.web.fetch.firecrawl.apiKey` or `FIRECRAWL_API_KEY`.\n\n### Config", "language": "unknown" } ], "headings": [ { "level": "h2", "text": "How it works", "id": "how-it-works" }, { "level": "h2", "text": "Choosing a search provider", "id": "choosing-a-search-provider" }, { "level": "h2", "text": "Getting a Brave API key", "id": "getting-a-brave-api-key" }, { "level": "h3", "text": "Where to set the key (recommended)", "id": "where-to-set-the-key-(recommended)" }, { "level": "h2", "text": "Using Perplexity (direct or via OpenRouter)", "id": "using-perplexity-(direct-or-via-openrouter)" }, { "level": "h3", "text": "Getting an OpenRouter API key", "id": "getting-an-openrouter-api-key" }, { "level": "h3", "text": "Setting up Perplexity search", "id": "setting-up-perplexity-search" }, { "level": "h3", "text": "Available Perplexity models", "id": "available-perplexity-models" }, { "level": "h2", "text": "web\\_search", "id": "web\\_search" }, { "level": "h3", "text": "Requirements", "id": "requirements" }, { "level": "h3", "text": "Config", "id": "config" }, { "level": "h3", "text": "Tool parameters", "id": "tool-parameters" }, { "level": "h2", "text": "web\\_fetch", "id": "web\\_fetch" }, { "level": "h3", "text": "Requirements", "id": "requirements" }, { "level": "h3", "text": "Config", "id": "config" }, { "level": "h3", "text": "Tool parameters", "id": "tool-parameters" } ], "url": "llms-txt#web-tools", "links": [] }