{"id":645,"date":"2026-03-21T22:52:58","date_gmt":"2026-03-21T14:52:58","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/tools-perplexity-search\/"},"modified":"2026-03-21T23:08:52","modified_gmt":"2026-03-21T15:08:52","slug":"tools-perplexity-search","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/tools-perplexity-search\/","title":{"rendered":"Perplexity Search"},"content":{"rendered":"<h1>Perplexity Search<\/h1>\n<h1>Perplexity Search API<\/h1>\n<p>OpenClaw supports Perplexity Search API as a <code>web_search<\/code> provider.<br \/>\nIt returns structured results with <code>title<\/code>, <code>url<\/code>, and <code>snippet<\/code> fields.<\/p>\n<p>For compatibility, OpenClaw also supports legacy Perplexity Sonar\/OpenRouter setups.<br \/>\nIf you use <code>OPENROUTER_API_KEY<\/code>, an <code>sk-or-...<\/code> key in <code>plugins.entries.perplexity.config.webSearch.apiKey<\/code>, or set <code>plugins.entries.perplexity.config.webSearch.baseUrl<\/code> \/ <code>model<\/code>, the provider switches to the chat-completions path and returns AI-synthesized answers with citations instead of structured Search API results.<\/p>\n<h2>Getting a Perplexity API key<\/h2>\n<ol>\n<li>Create a Perplexity account at <a href=\"https:\/\/www.perplexity.ai\/settings\/api\">perplexity.ai\/settings\/api<\/a><\/li>\n<li>Generate an API key in the dashboard<\/li>\n<li>Store the key in config or set <code>PERPLEXITY_API_KEY<\/code> in the Gateway environment.<\/li>\n<\/ol>\n<h2>OpenRouter compatibility<\/h2>\n<p>If you were already using OpenRouter for Perplexity Sonar, keep <code>provider: \"perplexity\"<\/code> and set <code>OPENROUTER_API_KEY<\/code> in the Gateway environment, or store an <code>sk-or-...<\/code> key in <code>plugins.entries.perplexity.config.webSearch.apiKey<\/code>.<\/p>\n<p>Optional compatibility controls:<\/p>\n<ul>\n<li><code>plugins.entries.perplexity.config.webSearch.baseUrl<\/code><\/li>\n<li><code>plugins.entries.perplexity.config.webSearch.model<\/code><\/li>\n<\/ul>\n<h2>Config examples<\/h2>\n<h3>Native Perplexity Search API<\/h3>\n<p>&#8220;`json5  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\n{<br \/>\n  plugins: {<br \/>\n    entries: {<br \/>\n      perplexity: {<br \/>\n        config: {<br \/>\n          webSearch: {<br \/>\n            apiKey: &#8220;pplx-&#8230;&#8221;,<br \/>\n          },<br \/>\n        },<br \/>\n      },<br \/>\n    },<br \/>\n  },<br \/>\n  tools: {<br \/>\n    web: {<br \/>\n      search: {<br \/>\n        provider: &#8220;perplexity&#8221;,<br \/>\n      },<br \/>\n    },<br \/>\n  },<br \/>\n}<\/p>\n<pre><code>\n### OpenRouter \/ Sonar compatibility\n\n```json5  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\n{\n  plugins: {\n    entries: {\n      perplexity: {\n        config: {\n          webSearch: {\n            apiKey: &quot;&lt;openrouter-api-key&gt;&quot;,\n            baseUrl: &quot;https:\/\/openrouter.ai\/api\/v1&quot;,\n            model: &quot;perplexity\/sonar-pro&quot;,\n          },\n        },\n      },\n    },\n  },\n  tools: {\n    web: {\n      search: {\n        provider: &quot;perplexity&quot;,\n      },\n    },\n  },\n}\n<\/code><\/pre>\n<h2>Where to set the key<\/h2>\n<p><strong>Via config:<\/strong> run <code>openclaw configure --section web<\/code>. It stores the key in<br \/>\n<code>~\/.openclaw\/openclaw.json<\/code> under <code>plugins.entries.perplexity.config.webSearch.apiKey<\/code>.<br \/>\nThat field also accepts SecretRef objects.<\/p>\n<p><strong>Via environment:<\/strong> set <code>PERPLEXITY_API_KEY<\/code> or <code>OPENROUTER_API_KEY<\/code><br \/>\nin the Gateway process environment. For a gateway install, put it in<br \/>\n<code>~\/.openclaw\/.env<\/code> (or your service environment). See <a href=\"\/help\/faq#how-does-openclaw-load-environment-variables\">Env vars<\/a>.<\/p>\n<p>If <code>provider: \"perplexity\"<\/code> is configured and the Perplexity key SecretRef is unresolved with no env fallback, startup\/reload fails fast.<\/p>\n<h2>Tool parameters<\/h2>\n<p>These parameters apply to the native Perplexity Search API path.<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>query<\/code><\/td>\n<td>Search query (required)<\/td>\n<\/tr>\n<tr>\n<td><code>count<\/code><\/td>\n<td>Number of results to return (1-10, default: 5)<\/td>\n<\/tr>\n<tr>\n<td><code>country<\/code><\/td>\n<td>2-letter ISO country code (e.g., &#8220;US&#8221;, &#8220;DE&#8221;)<\/td>\n<\/tr>\n<tr>\n<td><code>language<\/code><\/td>\n<td>ISO 639-1 language code (e.g., &#8220;en&#8221;, &#8220;de&#8221;, &#8220;fr&#8221;)<\/td>\n<\/tr>\n<tr>\n<td><code>freshness<\/code><\/td>\n<td>Time filter: <code>day<\/code> (24h), <code>week<\/code>, <code>month<\/code>, or <code>year<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>date_after<\/code><\/td>\n<td>Only results published after this date (YYYY-MM-DD)<\/td>\n<\/tr>\n<tr>\n<td><code>date_before<\/code><\/td>\n<td>Only results published before this date (YYYY-MM-DD)<\/td>\n<\/tr>\n<tr>\n<td><code>domain_filter<\/code><\/td>\n<td>Domain allowlist\/denylist array (max 20)<\/td>\n<\/tr>\n<tr>\n<td><code>max_tokens<\/code><\/td>\n<td>Total content budget (default: 25000, max: 1000000)<\/td>\n<\/tr>\n<tr>\n<td><code>max_tokens_per_page<\/code><\/td>\n<td>Per-page token limit (default: 2048)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>For the legacy Sonar\/OpenRouter compatibility path, only <code>query<\/code> and <code>freshness<\/code> are supported.<br \/>\nSearch API-only filters such as <code>country<\/code>, <code>language<\/code>, <code>date_after<\/code>, <code>date_before<\/code>, <code>domain_filter<\/code>, <code>max_tokens<\/code>, and <code>max_tokens_per_page<\/code> return explicit errors.<\/p>\n<p><strong>Examples:<\/strong><\/p>\n<p>&#8220;`javascript  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\n\/\/ Country and language-specific search<br \/>\nawait web_search({<br \/>\n  query: &#8220;renewable energy&#8221;,<br \/>\n  country: &#8220;DE&#8221;,<br \/>\n  language: &#8220;de&#8221;,<br \/>\n});<\/p>\n<p>\/\/ Recent results (past week)<br \/>\nawait web_search({<br \/>\n  query: &#8220;AI news&#8221;,<br \/>\n  freshness: &#8220;week&#8221;,<br \/>\n});<\/p>\n<p>\/\/ Date range search<br \/>\nawait web_search({<br \/>\n  query: &#8220;AI developments&#8221;,<br \/>\n  date_after: &#8220;2024-01-01&#8221;,<br \/>\n  date_before: &#8220;2024-06-30&#8221;,<br \/>\n});<\/p>\n<p>\/\/ Domain filtering (allowlist)<br \/>\nawait web_search({<br \/>\n  query: &#8220;climate research&#8221;,<br \/>\n  domain_filter: [&#8220;nature.com&#8221;, &#8220;science.org&#8221;, &#8220;.edu&#8221;],<br \/>\n});<\/p>\n<p>\/\/ Domain filtering (denylist &#8211; prefix with -)<br \/>\nawait web_search({<br \/>\n  query: &#8220;product reviews&#8221;,<br \/>\n  domain_filter: [&#8220;-reddit.com&#8221;, &#8220;-pinterest.com&#8221;],<br \/>\n});<\/p>\n<p>\/\/ More content extraction<br \/>\nawait web_search({<br \/>\n  query: &#8220;detailed AI research&#8221;,<br \/>\n  max_tokens: 50000,<br \/>\n  max_tokens_per_page: 4096,<br \/>\n});<br \/>\n&#8220;`<\/p>\n<h3>Domain filter rules<\/h3>\n<ul>\n<li>Maximum 20 domains per filter<\/li>\n<li>Cannot mix allowlist and denylist in the same request<\/li>\n<li>Use <code>-<\/code> prefix for denylist entries (e.g., <code>[\"-reddit.com\"]<\/code>)<\/li>\n<\/ul>\n<h2>Notes<\/h2>\n<ul>\n<li>Perplexity Search API returns structured web search results (<code>title<\/code>, <code>url<\/code>, <code>snippet<\/code>)<\/li>\n<li>OpenRouter or explicit <code>plugins.entries.perplexity.config.webSearch.baseUrl<\/code> \/ <code>model<\/code> switches Perplexity back to Sonar chat completions for compatibility<\/li>\n<li>Results are cached for 15 minutes by default (configurable via <code>cacheTtlMinutes<\/code>)<\/li>\n<\/ul>\n<p>See <a href=\"\/tools\/web\">Web tools<\/a> for the full web_search configuration.<br \/>\nSee <a href=\"https:\/\/docs.perplexity.ai\/docs\/search\/quickstart\">Perplexity Search API docs<\/a> for more details.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Perplexity Search Perplexity Search API OpenClaw suppor [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-645","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/comments?post=645"}],"version-history":[{"count":2,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/645\/revisions"}],"predecessor-version":[{"id":701,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/645\/revisions\/701"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}