pplx CLI returns structured JSON from the Perplexity Search API, making it useful for shell pipelines, interactive terminal work, and coding agents that need current web results or readable page content.
Install
Open the agent in your project and send it this:Authenticate
Every command needs a Perplexity API key. Choose one authentication method:- Environment variable
- Interactive login
Search the web
Response
Response
-n defaults to 10.
Run pplx search web --help for the full flag list and a summary of the input and output shapes.Filter results
These flags scope a search. They are the Search API filters, so their behavior and limits are identical — see domain filter and date and time filters for the details.--recency-filter cannot be combined with --published-after-date or --published-before-date.
That request fails with BAD_REQUEST.Ask the same question several ways
Extra positional queries are rephrasings of one question, not separate searches. The CLI still returns a single ranked result set, but wording the question more than one way surfaces pages that only match the phrasing you did not think of first:Save full results
Save the complete result while keeping stdout small:out/web/, and stdout includes its path in saved_to.
--stdout-preview only truncates stdout when you also set --output-dir or PPLX_OUTPUT_DIR.
Cut strings end in ...<truncated> and the response gains a top-level "truncated": true.
Search errors
A search either succeeds or fails outright: on failure nothing reaches stdout and the JSON error object goes to stderr. The search-specific code isBAD_REQUEST, which the service returns when the filters contradict each other, as with --recency-filter alongside a publication-date bound.
Everything else you can hit here is a common error.
Fetch page content
Retrieve cleaned text and page metadata from an HTTP or HTTPS URL:Response
Response
Serve from cache or crawl live
Fetches serve cached content by default, which is the fast and dependable path.is_cached in the response tells you which one you got.
--no-cache forces a live crawl of the origin instead:
is_cached set to false.
Expect a live crawl to fail on a fair share of pages, though: a slow origin or a robots.txt that disallows crawling comes back as a populated error and an empty content, where the cached path would have returned the text.
Reach for --no-cache only when you specifically need to bypass the cache.
Get the raw page source
--html returns the unprocessed page source in a raw_html field, for the cases where you need markup that the cleaner drops:
--no-cache, and the cleaned content comes back empty — you get raw_html instead of content, not in addition to it.
Keep large pages out of stdout
A single page is routinely tens of thousands of characters.--output-dir writes the full response under <dir>/fetch/, and --stdout-preview truncates the long strings on stdout:
saved_to plus "truncated": true, so the terminal stays readable while the complete text sits on disk.
Detect paywalled pages
is_paywall is true when the page sits behind a paywall or a login.
Only the fragment above the wall could be extracted, so content is real text but not the whole page.
Check it before you treat a fetch as complete.
Fetch errors
pplx content fetch does not fail the way the other commands do.
When the origin refuses the request or times out, the command still writes its normal JSON object to stdout: content comes back empty and error holds a message string.
Response
Response
error on every fetch, because a successful invocation does not mean you got a page.
Handle errors
These are the failures common to everypplx command.
A failed command writes one JSON error object to stderr:
error.code.
Error codes
Error codes
pplx <command> --help before assuming that a flag exists; CLI output is already JSON, so no --json flag is needed.
Next steps
See theperplexity-cli repository for release notes, manual installation, and uninstall instructions.