Files
openclaw/docs/perplexity.md

81 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2026-01-18 01:42:40 +00:00
---
summary: "Perplexity Sonar setup for web_search"
read_when:
- You want to use Perplexity Sonar for web search
- You need PERPLEXITY_API_KEY or OpenRouter setup
title: "Perplexity Sonar"
2026-01-18 01:42:40 +00:00
---
# Perplexity Sonar
2026-01-30 03:15:10 +01:00
OpenClaw can use Perplexity Sonar for the `web_search` tool. You can connect
2026-01-18 01:42:40 +00:00
through Perplexitys direct API or via OpenRouter.
## API options
### Perplexity (direct)
- Base URL: [https://api.perplexity.ai](https://api.perplexity.ai)
2026-01-18 01:42:40 +00:00
- Environment variable: `PERPLEXITY_API_KEY`
### OpenRouter (alternative)
- Base URL: [https://openrouter.ai/api/v1](https://openrouter.ai/api/v1)
2026-01-18 01:42:40 +00:00
- Environment variable: `OPENROUTER_API_KEY`
- Supports prepaid/crypto credits.
## Config example
```json5
{
tools: {
web: {
search: {
provider: "perplexity",
perplexity: {
apiKey: "pplx-...",
baseUrl: "https://api.perplexity.ai",
2026-01-31 21:13:13 +09:00
model: "perplexity/sonar-pro",
},
},
},
},
2026-01-18 01:42:40 +00:00
}
```
## Switching from Brave
```json5
{
tools: {
web: {
search: {
provider: "perplexity",
perplexity: {
apiKey: "pplx-...",
2026-01-31 21:13:13 +09:00
baseUrl: "https://api.perplexity.ai",
},
},
},
},
2026-01-18 01:42:40 +00:00
}
```
If both `PERPLEXITY_API_KEY` and `OPENROUTER_API_KEY` are set, set
`tools.web.search.perplexity.baseUrl` (or `tools.web.search.perplexity.apiKey`)
to disambiguate.
2026-01-30 03:15:10 +01:00
If no base URL is set, OpenClaw chooses a default based on the API key source:
- `PERPLEXITY_API_KEY` or `pplx-...` → direct Perplexity (`https://api.perplexity.ai`)
- `OPENROUTER_API_KEY` or `sk-or-...` → OpenRouter (`https://openrouter.ai/api/v1`)
- Unknown key formats → OpenRouter (safe fallback)
2026-01-18 01:42:40 +00:00
## Models
- `perplexity/sonar` — fast Q&A with web search
- `perplexity/sonar-pro` (default) — multi-step reasoning + web search
- `perplexity/sonar-reasoning-pro` — deep research
See [Web tools](/tools/web) for the full web_search configuration.