Setting Up the Perplexity Web Search Provider

Configure the Perplexity plugin as a web_search provider using the native Search API or Sonar chat completions via OpenRouter. Covers API keys, search modes, and filtering.

Read this when

  • You want to configure Perplexity as a web search provider
  • You need the Perplexity API key or OpenRouter proxy setup

The Perplexity plugin adds a web_search provider that supports two transports: the native Perplexity Search API (structured results with filters) and Perplexity Sonar chat completions, either direct or through OpenRouter (AI-synthesized answers that include citations).

Note

Setup of the Perplexity provider is what this page describes. For the Perplexity tool (how the agent uses it), see Perplexity search.

PropertyValue
TypeWeb search provider (not a model provider)
AuthPERPLEXITY_API_KEY (native) or OPENROUTER_API_KEY (via OpenRouter)
Config pathplugins.entries.perplexity.config.webSearch.apiKey
Overridesplugins.entries.perplexity.config.webSearch.baseUrl / .model
Get a keyperplexity.ai/settings/api

Install plugin

openclaw plugins install @openclaw/perplexity-plugin

When the Gateway is running, installation is applied automatically; if not, it takes effect the next time it starts. See Apply changes and inspect.

Getting started

Set the API key

openclaw configure --section web

You can also set the key directly:

openclaw config set plugins.entries.perplexity.config.webSearch.apiKey "pplx-xxxxxxxxxxxx"

A key exported as PERPLEXITY_API_KEY or OPENROUTER_API_KEY in the Gateway environment works as well.

Start searching

Once its key is the search credential that is available, web_search detects Perplexity automatically and no more setup is needed. To pin the provider explicitly:

openclaw config set tools.web.search.provider perplexity

Search modes

Transport resolution by the plugin follows this order:

  1. When webSearch.baseUrl or webSearch.model is set: routing always goes through Sonar chat completions against that endpoint, whatever the key type.
  2. If not, the endpoint is chosen by the key source: for a configured key, its prefix selects the transport (config takes precedence over environment variables); for an environment key, the matching endpoint is used directly.
Key prefixTransportFeatures
pplx-Native Perplexity Search API (https://api.perplexity.ai)Structured results, domain/language/date filters
sk-or-OpenRouter (https://openrouter.ai/api/v1), Sonar modelAI-synthesized answers with citations

A configured key carrying any other prefix falls back to the native Search API too. On the chat-completions path the model defaults to perplexity/sonar-pro; use plugins.entries.perplexity.config.webSearch.model to override it.

Native API filtering

FilterDescriptionTransport
countResults per search, 1-10 (default 5); accepted but ignored on the chat-completions pathBoth
freshnessRecency window: day, week, month, yearBoth
country2-letter country code (us, de, jp)Native only
languageISO 639-1 language code (en, fr, zh)Native only
date_after / date_beforePublished-date range in YYYY-MM-DDNative only
domain_filterMax 20 domains; allowlist or --prefixed denylist, never mixedNative only
max_tokens / max_tokens_per_pageContent budget across all results / per page; max_tokens max 1000000Native only

Filters that are native-only produce a descriptive error when used on the chat-completions path. freshness cannot be combined with date_after/date_before.

Advanced configuration

Environment variable for daemon processes

Warning

A key exported only in an interactive shell stays invisible to a launchd/systemd Gateway daemon, unless that environment is explicitly imported. Put the key in ~/.openclaw/.env or set it through env.shellEnv so the Gateway process can read it. The full precedence order is described in Environment variables.

OpenRouter proxy setup

Set an OPENROUTER_API_KEY (prefix sk-or-) in place of a native Perplexity key when you want Perplexity searches routed through OpenRouter. OpenClaw recognises that key and automatically switches to the Sonar transport. This helps if OpenRouter billing is already in place and you would rather keep providers consolidated there.

Integration header

Calls to the Perplexity API (api.perplexity.ai) identify OpenClaw by sending X-Pplx-Integration: openclaw/<version>. When searches go through OpenRouter, OpenRouter's app-attribution headers are sent instead. Neither set of headers reaches a custom proxy baseUrl.

677 words · updated Oct 25, 2026