跳轉到主要內容
Perplexity 外掛會註冊一個 web_search 提供者,並提供兩種傳輸方式:原生 Perplexity Search API(含篩選器的結構化結果)與 Perplexity Sonar chat completions,可直接使用或透過 OpenRouter(附引用來源的 AI 合成答案)。
本頁涵蓋 Perplexity 提供者設定。若要了解 Perplexity 工具(代理如何使用它),請參閱 Perplexity 搜尋
屬性
類型網頁搜尋提供者(不是模型提供者)
驗證PERPLEXITY_API_KEY(原生)或 OPENROUTER_API_KEY(透過 OpenRouter)
設定路徑plugins.entries.perplexity.config.webSearch.apiKey
覆寫plugins.entries.perplexity.config.webSearch.baseUrl / .model
取得金鑰perplexity.ai/settings/api

安裝外掛

openclaw plugins install @openclaw/perplexity-plugin
openclaw gateway restart

開始使用

1

設定 API 金鑰

openclaw configure --section web
或直接設定金鑰:
openclaw config set plugins.entries.perplexity.config.webSearch.apiKey "pplx-xxxxxxxxxxxx"
在閘道環境中匯出的 PERPLEXITY_API_KEYOPENROUTER_API_KEY 金鑰也可以使用。
2

開始搜尋

一旦可用的搜尋憑證是 Perplexity 金鑰,web_search 會自動偵測 Perplexity;不需要其他設定。若要明確固定提供者:
openclaw config set tools.web.search.provider perplexity

搜尋模式

此外掛會依照以下順序解析傳輸方式:
  1. 已設定 webSearch.baseUrlwebSearch.model:一律透過 Sonar chat completions 路由到該端點,無論金鑰類型為何。
  2. 否則,金鑰來源會決定端點:已設定金鑰的前綴會選擇傳輸方式(設定優先於環境變數);環境金鑰會直接使用其相符的端點。
金鑰前綴傳輸方式功能
pplx-原生 Perplexity Search API (https://api.perplexity.ai)結構化結果、網域/語言/日期篩選器
sk-or-OpenRouter (https://openrouter.ai/api/v1),Sonar 模型附引用來源的 AI 合成答案
任何其他前綴的已設定金鑰也會使用原生 Search API。chat-completions 路徑預設使用 perplexity/sonar-pro 模型;可透過 plugins.entries.perplexity.config.webSearch.model 覆寫。

原生 API 篩選

篩選器說明傳輸方式
count每次搜尋的結果數,1-10(預設 5)僅限原生
freshness新近度時間範圍:dayweekmonthyear兩者皆可
country2 字母國家/地區代碼(usdejp僅限原生
languageISO 639-1 語言代碼(enfrzh僅限原生
date_after / date_beforeYYYY-MM-DD 格式的發布日期範圍僅限原生
domain_filter最多 20 個網域;允許清單或以 - 前綴的拒絕清單,不可混用僅限原生
max_tokens / max_tokens_per_page所有結果/每頁的內容預算僅限原生
僅限原生的篩選器在 chat-completions 路徑上會回傳描述性錯誤。freshness 不能與 date_after/date_before 搭配使用。

進階設定

只在互動式 shell 中匯出的金鑰,除非明確匯入該環境,否則 launchd/systemd 閘道背景程序看不到。請在 ~/.openclaw/.env 中設定金鑰,或透過 env.shellEnv 設定,讓閘道程序可以讀取。完整優先順序請參閱環境變數
若要透過 OpenRouter 路由 Perplexity 搜尋,請設定 OPENROUTER_API_KEY(前綴 sk-or-),而不是原生 Perplexity 金鑰。OpenClaw 會偵測金鑰並自動切換到 Sonar 傳輸方式。如果你已經設定 OpenRouter 帳單並想在該處整合提供者,這會很有用。

相關

Perplexity 搜尋工具

代理如何呼叫 Perplexity 搜尋並解讀結果。

設定參考

完整設定參考,包括外掛項目。