pplx-npx-search
v0.1.0
Published
CLI for Perplexity AI with cookie-based auth
Readme
pplx-cli
CLI for Perplexity AI with cookie-based authentication. Designed for headless/agent-first usage — no browser required at runtime.
Prerequisites
- Node.js 20+
- Google Chrome (only for initial cookie extraction via
pplx auth)
Installation
git clone https://github.com/rajanrengasamy/pplx-cli.git
cd pplx-cli
npm install
npm linkAuthentication
Extract cookies from Chrome (one-time setup):
pplx auth
pplx auth --test # verify cookies workCookies are stored at ~/.config/pplx/cookies.json.
Usage
# Search (default: pro mode, headless HTTP)
pplx search "what is quantum computing"
# Reasoning mode
pplx reason "explain the Riemann hypothesis"
# Deep research
pplx research "compare React vs Vue in 2026"
# Labs (free, no auth needed)
pplx labs "hello world"
# List models
pplx modelsOptions
pplx search "query" --mode auto|pro|reasoning|deep-research
pplx search "query" --model claude-3.5-sonnet
pplx search "query" --json # single JSON object output
pplx search "query" --raw # plain text, no colors/spinner
pplx search "query" --chrome # use Chrome CDP bridge instead of HTTP
pplx search "query" --curl # force curl-impersonate for TLS
pplx search "query" --incognito # don't save to Perplexity history
pplx search "query" --citations-full # show full source detailsAgent/Automation Usage
pplx-cli is designed to work in automated pipelines and with AI agents:
# Plain text output (no colors, no spinner)
pplx search "query" --raw
# Read query from stdin
echo "what is 2+2" | pplx search -
# JSON output (single object: {answer, sources, query, mode, model})
pplx search "query" --json
# Pipe-friendly (auto-detects non-TTY)
pplx search "query" | head -1
# Non-zero exit code when no answer is returned
pplx search "query" --json || echo "failed"Architecture
- Default mode: Headless HTTP with stored cookies (no browser needed)
- Optional:
--chromeflag uses Chrome CDP bridge for TLS fingerprinting bypass - SSE streaming: Real-time answer streaming via Server-Sent Events
- Cookie auth: One-time extraction from Chrome, then fully headless
Configuration
Optional config file at ~/.config/pplx/config.json:
{
"mode": "pro",
"model": "claude-3.5-sonnet",
"lang": "en-US"
}Acknowledgements
This project was inspired by and built upon the reverse-engineering work in helallao/perplexity-ai — a Python library for the Perplexity AI API. The authentication flow, SSE protocol handling, and API structure were all derived from studying that project. Big thanks to @helallao for figuring out the hard parts.
pplx-cli is a ground-up Node.js reimplementation for CLI/agentic use cases, but it wouldn't exist without that foundational work.
License
MIT
