Perplexity search
기준일: 2026-07-26
난이도: 중급
공식 기준: Perplexity search
개요
이 페이지는 OpenClaw Perplexity search 도구(파라미터, 권한, 설정, CLI)를 공식 문서 기준으로 정리합니다.
공식 요약: Perplexity Search API and Sonar/OpenRouter compatibility for web_search
도구 가시성은 profile / allow·deny policy / sandbox / channel 권한에 따라 달라집니다. 최신 스키마는 항상 공식 문서를 우선합니다.
공식 문서 기반 상세
아래는 공식 tools/perplexity-search 문서를 정리한 내용입니다. 코드 블록, 파라미터 이름, 기본값은 원문 그대로입니다.
OpenClaw supports the Perplexity Search API as a web_search provider. It returns structured results with title, url, and snippet fields.
For compatibility, OpenClaw also supports legacy Perplexity Sonar/OpenRouter setups. If you use OPENROUTER_API_KEY, an sk-or-... key in plugins.entries.perplexity.config.webSearch.apiKey, or set plugins.entries.perplexity.config.webSearch.baseUrl / model, the provider switches to the chat-completions path and returns AI-synthesized answers with citations instead of structured Search API results.
Install plugin
Install the official plugin, then restart Gateway:
openclaw plugins install @openclaw/perplexity-plugin
openclaw gateway restart
Getting a Perplexity API key
- Create a Perplexity account at perplexity.ai/settings/api.
- Generate an API key in the dashboard.
- Store the key in config or set
PERPLEXITY_API_KEYin the Gateway environment.
OpenRouter compatibility
If you were already using OpenRouter for Perplexity Sonar, keep provider: "perplexity" and set OPENROUTER_API_KEY in the Gateway environment, or store an sk-or-... key in plugins.entries.perplexity.config.webSearch.apiKey.
Optional compatibility controls:
plugins.entries.perplexity.config.webSearch.baseUrlplugins.entries.perplexity.config.webSearch.model
Config examples
Native Perplexity Search API
{
plugins: {
entries: {
perplexity: {
config: {
webSearch: {
apiKey: "pplx-...",
},
},
},
},
},
tools: {
web: {
search: {
provider: "perplexity",
},
},
},
}
OpenRouter / Sonar compatibility
{
plugins: {
entries: {
perplexity: {
config: {
webSearch: {
apiKey: "<openrouter-api-key>",
baseUrl: "https://openrouter.ai/api/v1",
model: "perplexity/sonar-pro",
},
},
},
},
},
tools: {
web: {
search: {
provider: "perplexity",
},
},
},
}
Where to set the key
Via config: run openclaw configure --section web. It stores the key in ~/.openclaw/openclaw.json under plugins.entries.perplexity.config.webSearch.apiKey. That field also accepts SecretRef objects.
Via environment: set PERPLEXITY_API_KEY or OPENROUTER_API_KEY in the Gateway process environment. For a gateway install, put it in ~/.openclaw/.env (or your service environment). See Env vars.
If provider: "perplexity" is configured and the Perplexity key SecretRef is unresolved with no env fallback, startup/reload fails fast.
Tool parameters
These parameters apply to the native Perplexity Search API path.
query(string) (required): Search query.count(number) · default:5: Number of results to return (1-10).country(string): 2-letter ISO country code (e.g.US,DE).language(string): ISO 639-1 language code (e.g.en,de,fr).freshness('day' | 'week' | 'month' | 'year'): Time filter -dayis 24 hours.date_after(string): Only results published after this date (YYYY-MM-DD).date_before(string): Only results published before this date (YYYY-MM-DD).domain_filter(string[]): Domain allowlist/denylist array (max 20).max_tokens(number) · default:25000: Total content budget (max 1000000).max_tokens_per_page(number) · default:2048: Per-page token limit.
For the legacy Sonar/OpenRouter compatibility path:
query,count, andfreshnessare accepted.countis compatibility-only there; the response is still one synthesized answer with citations rather than an N-result list.- Search API-only filters (
country,language,date_after,date_before,domain_filter,max_tokens,max_tokens_per_page) return explicit errors.
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",
});
// Domain filtering (allowlist)
await web_search({
query: "climate research",
domain_filter: ["nature.com", "science.org", ".edu"],
});
// Domain filtering (denylist - prefix with -)
await web_search({
query: "product reviews",
domain_filter: ["-reddit.com", "-pinterest.com"],
});
// More content extraction
await web_search({
query: "detailed AI research",
max_tokens: 50000,
max_tokens_per_page: 4096,
});
Domain filter rules
- Maximum 20 domains per filter.
- Cannot mix allowlist and denylist entries in the same request.
- Use a
-prefix for denylist entries (e.g.,["-reddit.com"]).
참고
- Perplexity Search API returns structured web search results (
title,url,snippet). - OpenRouter, or an explicit
plugins.entries.perplexity.config.webSearch.baseUrl/model, switches Perplexity back to Sonar chat completions for compatibility. - Sonar/OpenRouter compatibility returns one synthesized answer with citations, not structured result rows.
- Results are cached for 15 minutes by default (configurable via
cacheTtlMinutes).
관련 문서
All providers and auto-detection rules.
Structured results with country and language filters.
Neural search with content extraction.
Official Perplexity Search API quickstart and reference.
검증 체크리스트
- 해당 tool이 활성 profile/policy에서 허용되는지 확인
- sandbox / elevated / host 실행 경로 정책을 이해했는지 확인
- 채널·에이전트 권한과 충돌하지 않는지 확인
- 공식 CLI/
--help와 문서 옵션이 버전과 맞는지 확인