Appearance
在 OpenClaw 中配置 Perplexity 网络搜索提供商,只需设置对应 API Key(原生 Perplexity 或 OpenRouter 代理)。运行 openclaw configure --section web 或直接通过 openclaw config set 写入 Key,Agent 会自动启用搜索能力。注意:仅原生 Perplexity API(Key 以 pplx- 开头)支持域名、语言、日期等过滤参数,OpenRouter(sk-or-)仅返回 AI 合成答案;守护进程(launchd/systemd)需单独加载环境变量。
OpenClaw Perplexity 网络搜索提供商配置(API Key/OpenRouter)
Perplexity 插件通过 Perplexity Search API 或经由 OpenRouter 的 Perplexity Sonar 提供网络搜索能力。
注意:本页是 Perplexity 提供商配置。如果了解 Agent 如何使用搜索结果,请查看 Perplexity 搜索工具。
| 属性 | 值 |
|---|---|
| 类型 | 网络搜索提供商(非模型提供商) |
| 鉴权方式 | PERPLEXITY_API_KEY(直连)或 OPENROUTER_API_KEY(通过 OpenRouter) |
| 配置路径 | plugins.entries.perplexity.config.webSearch.apiKey |
快速开始
设置 API Key
运行交互式网络搜索配置流程:bashopenclaw configure --section web或直接设置:
bashopenclaw config set plugins.entries.perplexity.config.webSearch.apiKey "pplx-xxxxxxxxxxxx"开始搜索
配置完成后,Agent 在需要网络搜索时会自动使用 Perplexity,无需额外步骤。
搜索模式(自动选择传输方式)
插件根据 API Key 前缀自动决定使用哪种后端:
| Key 前缀 | 传输方式 | 功能特点 |
|---|---|---|
pplx- | 原生 Perplexity Search API | 结构化结果,支持域名/语言/日期过滤(见下方过滤说明) |
sk-or- | OpenRouter(Perplexity Sonar) | AI 合成答案并附带引用 |
原生 API 过滤参数(仅 pplx- Key 适用)
使用原生 Perplexity API 时(Key 以 pplx- 开头),搜索支持以下过滤。OpenRouter/Sonar 不支持这些参数。
| 过滤项 | 说明 | 示例值 |
|---|---|---|
| Country | 2 字母国家代码 | us, de, jp |
| Language | ISO 639-1 语言代码 | en, fr, zh |
| Date range | 时间范围 | day, week, month, year |
| Domain filters | 域名白名单/黑名单(最多 20 个) | example.com |
| Content budget | 每次响应的 token 限制 | max_tokens, max_tokens_per_page |
进阶配置
环境变量(守护进程使用)
如果 Gateway 以守护进程方式运行(launchd/systemd),请确保 PERPLEXITY_API_KEY 对该进程可见。
WARNING
仅在交互式 Shell 中 export 的 Key 不会被 launchd/systemd 继承。请将 Key 写入 ~/.openclaw/.env 或通过 env.shellEnv 配置,确保 Gateway 进程能读到。
OpenRouter 代理设置
如果你希望通过 OpenRouter 走 Perplexity Sonar 流量,设置 OPENROUTER_API_KEY(前缀 sk-or-)代替原生 Perplexity Key。OpenClaw 会自动检测前缀并切换传输方式。
TIP
如果你已有 OpenRouter 账户,希望统一结算多个提供商,使用 OpenRouter 代理更方便。
相关资源
常见问题
配置 Perplexity 后,Agent 搜索不生效怎么办?
检查 API Key 是否正确设置(运行 openclaw config get plugins.entries.perplexity.config.webSearch.apiKey 确认)。如果使用 daemon 模式,确认环境变量已写入 ~/.openclaw/.env。
我通过 OpenRouter 接入,为什么搜索过滤不起作用?
OpenRouter(sk-or- 前缀)使用 Perplexity Sonar 模型,该模式不支持域名、语言、日期等过滤参数。仅原生 Perplexity API(pplx-)支持这些过滤。
如何切换 Perplexity 的搜索模式?
只需更换 API Key:设置 pplx- 开头密钥使用原生 API,设置 sk-or- 开头密钥使用 OpenRouter 代理。更改后无需重启,Agent 下次搜索自动识别。