pplx-zero 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +401 -259
- package/dist/index.js +283 -175
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,404 +1,546 @@
|
|
|
1
|
-
# PPLX
|
|
1
|
+
# PPLX‑Zero
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
🚀 **Lightning-fast Perplexity AI in your terminal** — sub‑1s search responses with multimodal support. Built for developers, coding agents, and automation workflows that demand speed and reliability.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
<a href="https://badge.fury.io/js/pplx-zero"><img src="https://badge.fury.io/js/pplx-zero.svg" alt="npm version"></a>
|
|
7
|
-
<a href="https://aur.archlinux.org/packages/pplx-zero"><img src="https://img.shields.io/aur/version/pplx-zero?style=flat-square" alt="AUR package"></a>
|
|
8
|
-
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white" alt="TypeScript"></a>
|
|
9
|
-
<a href="https://bun.sh"><img src="https://img.shields.io/badge/Bun-black?logo=bun&logoColor=white" alt="Bun"></a>
|
|
10
|
-
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
11
|
-
</p>
|
|
5
|
+
Perfect for rapid research, document analysis, image understanding, and batch processing with minimal configuration.
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Features
|
|
7
|
+
---
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
- **🎯 Simple Setup** - Works with just an API key, no configuration required
|
|
19
|
-
- **📦 Batch Processing** - Handle multiple searches simultaneously
|
|
20
|
-
- **🔄 Real-time Updates** - JSONL streaming progress events
|
|
21
|
-
- **🖼️ File Analysis** - Process documents and images with AI models
|
|
22
|
-
- **🤖 AI Models** - Sonar, Sonar Pro, Sonar Deep Research, Sonar Reasoning
|
|
23
|
-
- **🛡️ Type Safe** - Full Zod validation and TypeScript support
|
|
24
|
-
- **🌍 Cross-Platform** - Native Bun runtime support
|
|
25
|
-
- **🔄 Auto-Update** - Background update checking to stay current
|
|
9
|
+
## ✨ What Makes PPLX‑Zero Special
|
|
26
10
|
|
|
27
|
-
|
|
11
|
+
- **⚡ Blazing Fast**: Get answers in under a second with optimized API calls
|
|
12
|
+
- **🧠 Smart Models**: Choose from Sonar, Sonar‑Pro, Sonar‑Reasoning, and Deep‑Research models
|
|
13
|
+
- **📎 Multimodal**: Analyze documents, images, and combinations seamlessly
|
|
14
|
+
- **🔄 Auto‑Update**: Stay current with simplified update management
|
|
15
|
+
- **⚙️ Developer‑First**: Built for CI/CD, agent pipelines, and programmatic use
|
|
16
|
+
- **🎯 Minimal Setup**: One environment variable and you're ready to go
|
|
28
17
|
|
|
29
|
-
|
|
18
|
+
## 📦 Installation
|
|
30
19
|
|
|
31
|
-
|
|
20
|
+
Choose the installation method that works best for you:
|
|
32
21
|
|
|
33
|
-
|
|
34
|
-
<a href="https://badge.fury.io/js/pplx-zero"><img src="https://badge.fury.io/js/pplx-zero.svg" alt="npm version"></a>
|
|
35
|
-
<a href="https://aur.archlinux.org/packages/pplx-zero"><img src="https://img.shields.io/aur/version/pplx-zero?style=flat-square" alt="AUR package"></a>
|
|
36
|
-
</p>
|
|
22
|
+
### 🚀 Quick Install (Recommended)
|
|
37
23
|
|
|
38
24
|
```bash
|
|
39
|
-
# npm
|
|
25
|
+
# npm or bun (global)
|
|
40
26
|
npm install -g pplx-zero
|
|
27
|
+
# or
|
|
28
|
+
bun install -g pplx-zero
|
|
29
|
+
|
|
30
|
+
# Verify installation
|
|
31
|
+
pplx --version
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 📦 Binary Download (No Node.js required)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Download the appropriate binary for your platform
|
|
38
|
+
# Linux (x64) - Most servers and desktops
|
|
39
|
+
wget https://github.com/codewithkenzo/pplx-zero/releases/latest/download/pplx-v1.1.7-linux-x64
|
|
40
|
+
chmod +x pplx-v1.1.7-linux-x64
|
|
41
|
+
sudo mv pplx-v1.1.7-linux-x64 /usr/local/bin/pplx
|
|
42
|
+
|
|
43
|
+
# Linux (ARM64) - Raspberry Pi, ARM servers
|
|
44
|
+
wget https://github.com/codewithkenzo/pplx-zero/releases/latest/download/pplx-v1.1.7-linux-arm64
|
|
45
|
+
chmod +x pplx-v1.1.7-linux-arm64
|
|
46
|
+
sudo mv pplx-v1.1.7-linux-arm64 /usr/local/bin/pplx
|
|
47
|
+
|
|
48
|
+
# macOS (Intel) - Macs with Intel processors
|
|
49
|
+
wget https://github.com/codewithkenzo/pplx-zero/releases/latest/download/pplx-v1.1.7-darwin-x64
|
|
50
|
+
chmod +x pplx-v1.1.7-darwin-x64
|
|
51
|
+
sudo mv pplx-v1.1.7-darwin-x64 /usr/local/bin/pplx
|
|
52
|
+
|
|
53
|
+
# macOS (Apple Silicon) - Macs with M1/M2/M3 chips
|
|
54
|
+
wget https://github.com/codewithkenzo/pplx-zero/releases/latest/download/pplx-v1.1.7-darwin-arm64
|
|
55
|
+
chmod +x pplx-v1.1.7-darwin-arm64
|
|
56
|
+
sudo mv pplx-v1.1.7-darwin-arm64 /usr/local/bin/pplx
|
|
57
|
+
|
|
58
|
+
# Windows (x64) - Most Windows computers
|
|
59
|
+
# Download pplx-v1.1.7-windows-x64.exe from GitHub releases
|
|
60
|
+
# Add to your PATH or run directly
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Alternative Installation Script (Linux/macOS):**
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Automated installation script
|
|
67
|
+
curl -sSL https://github.com/codewithkenzo/pplx-zero/releases/latest/download/pplx-v1.1.7-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/x86_64/x64/') -o pplx
|
|
68
|
+
chmod +x pplx
|
|
69
|
+
sudo mv pplx /usr/local/bin/pplx
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 🏛️ AUR (Arch Linux)
|
|
41
73
|
|
|
42
|
-
|
|
74
|
+
```bash
|
|
75
|
+
# Using yay (recommended)
|
|
43
76
|
yay -S pplx-zero
|
|
44
77
|
|
|
45
|
-
#
|
|
46
|
-
|
|
47
|
-
cd pplx-zero
|
|
48
|
-
makepkg -si
|
|
78
|
+
# Using paru
|
|
79
|
+
paru -S pplx-zero
|
|
49
80
|
|
|
50
81
|
# Verify installation
|
|
51
82
|
pplx --version
|
|
52
83
|
```
|
|
53
84
|
|
|
54
|
-
|
|
85
|
+
### 🔧 Build from Source
|
|
55
86
|
|
|
56
87
|
```bash
|
|
57
|
-
# Clone
|
|
88
|
+
# 1) Clone the repository
|
|
58
89
|
git clone https://github.com/codewithkenzo/pplx-zero.git
|
|
59
90
|
cd pplx-zero
|
|
91
|
+
|
|
92
|
+
# 2) Install dependencies and build
|
|
60
93
|
bun install && bun run build
|
|
61
94
|
|
|
62
|
-
#
|
|
63
|
-
sudo ln -s "$(pwd)/dist/
|
|
95
|
+
# 3) Link the CLI (system-wide)
|
|
96
|
+
sudo ln -s "$(pwd)/dist/index.js" /usr/local/bin/pplx
|
|
64
97
|
|
|
65
|
-
# Verify installation
|
|
98
|
+
# 4) Verify installation
|
|
66
99
|
pplx --version
|
|
67
100
|
```
|
|
68
101
|
|
|
69
|
-
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## ⚙️ Configuration
|
|
105
|
+
|
|
106
|
+
### API Key Setup
|
|
107
|
+
|
|
108
|
+
Set your Perplexity API key as an environment variable:
|
|
70
109
|
|
|
71
110
|
**Linux/macOS:**
|
|
72
111
|
```bash
|
|
112
|
+
# Temporary (current session)
|
|
73
113
|
export PERPLEXITY_API_KEY="your-api-key"
|
|
114
|
+
|
|
115
|
+
# Permanent (add to ~/.bashrc, ~/.zshrc, etc.)
|
|
116
|
+
echo 'export PERPLEXITY_API_KEY="your-api-key"' >> ~/.bashrc
|
|
117
|
+
source ~/.bashrc
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Windows (PowerShell):**
|
|
121
|
+
```powershell
|
|
122
|
+
# Temporary (current session)
|
|
123
|
+
$env:PERPLEXITY_API_KEY = "your-api-key"
|
|
124
|
+
|
|
125
|
+
# Permanent
|
|
126
|
+
[Environment]::SetEnvironmentVariable("PERPLEXITY_API_KEY", "your-api-key", "User")
|
|
74
127
|
```
|
|
75
128
|
|
|
76
|
-
**Windows:**
|
|
129
|
+
**Windows (CMD):**
|
|
77
130
|
```cmd
|
|
131
|
+
# Permanent
|
|
78
132
|
setx PERPLEXITY_API_KEY "your-api-key"
|
|
79
133
|
```
|
|
80
134
|
|
|
81
|
-
**Get your API key
|
|
82
|
-
|
|
83
|
-
### 3️⃣ Start Searching
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
# Simple search
|
|
87
|
-
pplx "latest AI developments"
|
|
135
|
+
> 🔑 **Get your API key** from your [Perplexity account settings](https://www.perplexity.ai/settings/api) and keep it secure. Never share your API key or commit it to version control.
|
|
88
136
|
|
|
89
|
-
|
|
90
|
-
pplx --model sonar-pro "Explain quantum computing"
|
|
137
|
+
---
|
|
91
138
|
|
|
92
|
-
|
|
93
|
-
pplx --file report.pdf "Summarize this document"
|
|
139
|
+
## 🔄 Auto‑Update Management
|
|
94
140
|
|
|
95
|
-
|
|
96
|
-
pplx --image screenshot.png "What does this interface do?"
|
|
141
|
+
PPLX‑Zero includes a simplified auto‑update system that keeps you current with the latest features and security updates.
|
|
97
142
|
|
|
98
|
-
|
|
99
|
-
pplx --file data.csv --image chart.png "Analyze this data"
|
|
143
|
+
### Basic Update Commands
|
|
100
144
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
pplx --
|
|
145
|
+
```bash
|
|
146
|
+
# Check for available updates
|
|
147
|
+
pplx update --check
|
|
104
148
|
|
|
105
|
-
#
|
|
106
|
-
pplx --
|
|
149
|
+
# Install updates and relaunch automatically
|
|
150
|
+
pplx update --auto
|
|
107
151
|
```
|
|
108
152
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
PPLX-Zero includes intelligent auto-update functionality that runs in the background to keep your CLI current.
|
|
153
|
+
### Update Workflow
|
|
112
154
|
|
|
113
|
-
|
|
155
|
+
1. **Automatic Notifications**: PPLX‑Zero checks for updates once per day and notifies you when a new version is available
|
|
156
|
+
2. **Smart Installation**: The updater detects your installation method (npm, AUR, binary) and uses the appropriate update mechanism
|
|
157
|
+
3. **Seamless Relaunch**: When using `--auto`, PPLX‑Zero installs the update and relaunches with your original command
|
|
114
158
|
|
|
115
|
-
|
|
116
|
-
- **Non-Blocking**: Never slows down your search queries - updates happen in the background
|
|
117
|
-
- **Smart Caching**: Uses intelligent caching to avoid unnecessary network requests
|
|
118
|
-
- **Silent by Default**: Runs quietly without interrupting your workflow
|
|
119
|
-
|
|
120
|
-
### Update Commands
|
|
159
|
+
### Advanced Update Options
|
|
121
160
|
|
|
122
161
|
```bash
|
|
123
|
-
#
|
|
162
|
+
# Force update check (ignores cache)
|
|
124
163
|
pplx update --check
|
|
125
164
|
|
|
126
|
-
#
|
|
127
|
-
pplx update --auto
|
|
165
|
+
# Update during automation without interaction
|
|
166
|
+
pplx update --auto --quiet
|
|
167
|
+
```
|
|
128
168
|
|
|
129
|
-
|
|
130
|
-
pplx version
|
|
169
|
+
### Troubleshooting Updates
|
|
131
170
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
171
|
+
| Issue | Solution |
|
|
172
|
+
|-------|----------|
|
|
173
|
+
| **Permission denied** | Run with `sudo` or check installation directory permissions |
|
|
174
|
+
| **Network timeout** | Check internet connection and try again |
|
|
175
|
+
| **Update fails** | Manually install using your original installation method |
|
|
176
|
+
| **Lock file error** | Wait for current update to complete or manually remove `~/.pplx-zero/.updating.lock` |
|
|
135
177
|
|
|
136
|
-
|
|
178
|
+
The auto‑update system respects your system configuration and won't modify files without proper permissions.
|
|
137
179
|
|
|
138
|
-
|
|
180
|
+
---
|
|
139
181
|
|
|
140
|
-
|
|
141
|
-
2. **bun global** (`bun update -g pplx-zero`)
|
|
142
|
-
3. **yarn global** (`yarn global upgrade pplx-zero`)
|
|
143
|
-
4. **pnpm global** (`pnpm update -g pplx-zero`)
|
|
182
|
+
## 🚀 Quick Examples
|
|
144
183
|
|
|
145
|
-
|
|
184
|
+
### Basic Search
|
|
146
185
|
|
|
147
|
-
|
|
186
|
+
```bash
|
|
187
|
+
# Simple search (default model: sonar)
|
|
188
|
+
pplx "python type hints best practices"
|
|
148
189
|
|
|
149
|
-
|
|
190
|
+
# Multiple queries in one command
|
|
191
|
+
pplx "React hooks tutorial" "TypeScript generics" "Docker best practices"
|
|
192
|
+
```
|
|
150
193
|
|
|
151
|
-
|
|
152
|
-
- **Quiet Mode**: Silent operation to not interrupt workflow
|
|
153
|
-
- **Auto Install**: Disabled by default for safety
|
|
194
|
+
### Advanced Models
|
|
154
195
|
|
|
155
|
-
|
|
196
|
+
```bash
|
|
197
|
+
# Research with Sonar Pro (more detailed analysis)
|
|
198
|
+
pplx -m sonar-pro "React 19 Hooks new features"
|
|
156
199
|
|
|
157
|
-
|
|
158
|
-
-
|
|
159
|
-
- **Fast Performance**: Cached results prevent repeated network requests
|
|
160
|
-
- **Local Only**: All update logic runs locally on your machine
|
|
200
|
+
# Deep research with comprehensive web context
|
|
201
|
+
pplx -m sonar-deep-research "best Rust web frameworks 2025"
|
|
161
202
|
|
|
162
|
-
|
|
203
|
+
# Mathematical reasoning and proofs
|
|
204
|
+
pplx -m sonar-reasoning "prove this algorithm runs in O(n log n)"
|
|
205
|
+
```
|
|
163
206
|
|
|
164
|
-
###
|
|
207
|
+
### Document & Image Analysis
|
|
165
208
|
|
|
166
|
-
**Quick Reference:**
|
|
167
209
|
```bash
|
|
168
|
-
#
|
|
169
|
-
pplx "
|
|
210
|
+
# Summarize a PDF report quickly
|
|
211
|
+
pplx -f report.pdf "summarize key findings and risks"
|
|
170
212
|
|
|
171
|
-
#
|
|
172
|
-
pplx -
|
|
213
|
+
# Understand an interface from a screenshot
|
|
214
|
+
pplx -i screenshot.png "what is this UI and what are the next steps?"
|
|
173
215
|
|
|
174
|
-
#
|
|
175
|
-
pplx
|
|
216
|
+
# Combine multiple files in one analysis
|
|
217
|
+
pplx -f data.csv -i chart.png "spot anomalies and explain the chart"
|
|
176
218
|
|
|
177
|
-
#
|
|
178
|
-
pplx --
|
|
179
|
-
```
|
|
219
|
+
# Multiple file attachments
|
|
220
|
+
pplx -f report.pdf --attach data.csv --attach summary.md "analyze all documents"
|
|
180
221
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
# Model selection
|
|
184
|
-
pplx -m sonar-pro "Detailed analysis"
|
|
222
|
+
# Multiple documents of same type using --attach
|
|
223
|
+
pplx --attach doc1.pdf --attach doc2.pdf --attach doc3.txt "compare all reports"
|
|
185
224
|
|
|
186
|
-
#
|
|
187
|
-
pplx -
|
|
225
|
+
# Multiple images using --attach-image
|
|
226
|
+
pplx --attach-image screenshot1.png --attach-image screenshot2.png "analyze the UI flow"
|
|
188
227
|
|
|
189
|
-
#
|
|
190
|
-
pplx -
|
|
228
|
+
# Mixed multiple files (documents + images)
|
|
229
|
+
pplx -f main.pdf --attach appendix.md --attach-image chart.png --attach-image diagram.jpg "comprehensive analysis"
|
|
191
230
|
|
|
192
|
-
#
|
|
193
|
-
pplx
|
|
231
|
+
# Multiple files with positional arguments (all treated as files)
|
|
232
|
+
pplx file1.pdf file2.txt file3.md "what's in these files"
|
|
194
233
|
```
|
|
195
234
|
|
|
196
235
|
### Batch Processing
|
|
197
236
|
|
|
198
|
-
|
|
237
|
+
```bash
|
|
238
|
+
# Stream newline-delimited JSON for agents or UNIX pipes
|
|
239
|
+
pplx -o jsonl "AI trends"
|
|
199
240
|
|
|
241
|
+
# Batch from a JSON file with custom concurrency
|
|
242
|
+
pplx -I queries.json -o jsonl -c 5 -t 30000
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Batch JSON format:**
|
|
200
246
|
```json
|
|
201
247
|
{
|
|
202
248
|
"version": "1.0.0",
|
|
203
249
|
"requests": [
|
|
204
|
-
{"op": "search", "args": {"query": "AI trends", "maxResults": 5}},
|
|
205
|
-
{"op": "search", "args": {"query": "TypeScript patterns", "maxResults": 3}}
|
|
206
|
-
{"op": "search", "args": {"query": "Bun performance", "maxResults": 3}}
|
|
250
|
+
{ "op": "search", "args": { "query": "AI trends", "maxResults": 5 } },
|
|
251
|
+
{ "op": "search", "args": { "query": "TypeScript patterns", "maxResults": 3 } }
|
|
207
252
|
],
|
|
208
|
-
"options": {
|
|
209
|
-
"concurrency": 5,
|
|
210
|
-
"timeoutMs": 30000
|
|
211
|
-
}
|
|
253
|
+
"options": { "concurrency": 5, "timeoutMs": 30000 }
|
|
212
254
|
}
|
|
213
255
|
```
|
|
214
256
|
|
|
215
|
-
|
|
257
|
+
### Advanced Workflows
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Fire-and-forget async with webhook callback
|
|
261
|
+
pplx --async --webhook http://localhost:3000/callback "long research task"
|
|
262
|
+
|
|
263
|
+
# Export results to file
|
|
264
|
+
pplx --export results.json "machine learning trends"
|
|
265
|
+
|
|
266
|
+
# Search with custom result limits
|
|
267
|
+
pplx -n 10 "latest web development frameworks"
|
|
268
|
+
|
|
269
|
+
# Query from stdin (for pipelines)
|
|
270
|
+
echo '{"query": "best practices for API design"}' | pplx -s
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Real‑World Scenarios
|
|
216
274
|
|
|
217
275
|
```bash
|
|
218
|
-
|
|
276
|
+
# Security researcher: Analyze vulnerability report
|
|
277
|
+
pplx -f vuln_report.pdf --attach screenshots/ "explain security implications"
|
|
278
|
+
|
|
279
|
+
# Data analyst: Extract insights from datasets
|
|
280
|
+
pplx -f sales_data.csv -i revenue_chart.png "identify growth opportunities"
|
|
281
|
+
|
|
282
|
+
# Developer: Code review and optimization
|
|
283
|
+
pplx -f app.py --attach perf_metrics.json "suggest performance improvements"
|
|
284
|
+
|
|
285
|
+
# Product manager: Competitive analysis
|
|
286
|
+
pplx -f competitor_data.pdf "summarize key differentiators and market position"
|
|
219
287
|
```
|
|
220
288
|
|
|
221
|
-
### File Attachments
|
|
222
289
|
|
|
223
|
-
|
|
290
|
+
---
|
|
224
291
|
|
|
225
|
-
|
|
292
|
+
## 📋 Command Reference
|
|
293
|
+
|
|
294
|
+
### Main Options
|
|
295
|
+
|
|
296
|
+
| Flag | Short | Description | Example |
|
|
297
|
+
|------|-------|-------------|---------|
|
|
298
|
+
| `--model` | `-m` | AI model to use | `-m sonar-pro` |
|
|
299
|
+
| `--max-results` | `-n` | Max results per query (1-20) | `-n 10` |
|
|
300
|
+
| `--file` | `-f` | Attach document for analysis | `-f report.pdf` |
|
|
301
|
+
| `--image` | `-i` | Attach image for analysis | `-i screenshot.png` |
|
|
302
|
+
| `--format` | `-o` | Output format: json/jsonl | `-o jsonl` |
|
|
303
|
+
| `--query` | `-q` | Search query (alternative to positional) | `-q "search term"` |
|
|
304
|
+
| `--export` | | Export results to file | `--export results.json` |
|
|
305
|
+
| `--input` | `-I` | Read queries from JSON file | `-I batch.json` |
|
|
306
|
+
| `--stdin` | `-s` | Read queries from stdin | `cat query.json \| pplx -s` |
|
|
307
|
+
| `--attach` | | Additional file attachments | `--attach file1.pdf --attach file2.txt` |
|
|
308
|
+
| `--attach-image` | | Additional image attachments | `--attach-image img1.png --attach-image img2.jpg` |
|
|
309
|
+
| `--async` | | Enable async mode for advanced models | `--async` |
|
|
310
|
+
| `--webhook` | | Webhook URL for async results | `--webhook http://localhost:3000` |
|
|
311
|
+
| `--workspace` | | Workspace directory for file operations | `--workspace ./project` |
|
|
312
|
+
| `--use-search-api` | | Use search API (default: true) | `--use-search-api` |
|
|
313
|
+
| `--batch-size` | | Batch size for processing (1-100) | `--batch-size 50` |
|
|
314
|
+
|
|
315
|
+
### Performance & Control
|
|
316
|
+
|
|
317
|
+
| Flag | Description | Default | Range |
|
|
318
|
+
|------|-------------|---------|-------|
|
|
319
|
+
| `--concurrency` | Max parallel requests for batch operations | 5 | 1-20 |
|
|
320
|
+
| `--timeout` | Request timeout in milliseconds | 30000 | 1000-300000 |
|
|
321
|
+
|
|
322
|
+
### Utility Commands
|
|
323
|
+
|
|
324
|
+
| Command | Description | Example |
|
|
325
|
+
|---------|-------------|---------|
|
|
326
|
+
| `update --check` | Check for available updates | `pplx update --check` |
|
|
327
|
+
| `update --auto` | Install updates and relaunch | `pplx update --auto` |
|
|
328
|
+
| `history [limit]` | Show search history | `pplx history 10` |
|
|
329
|
+
| `version` | Show version information | `pplx version` |
|
|
330
|
+
| `--help` | Show help message | `pplx --help` |
|
|
331
|
+
| `--version` | Show version number | `pplx --version` |
|
|
332
|
+
|
|
333
|
+
### Supported File Formats
|
|
334
|
+
|
|
335
|
+
**Documents (up to 50MB):**
|
|
226
336
|
- PDF, DOC, DOCX, TXT, RTF, MD
|
|
337
|
+
- CSV, JSON (structured data)
|
|
338
|
+
- XML, YAML (configuration files)
|
|
227
339
|
|
|
228
|
-
**Images (
|
|
229
|
-
- PNG, JPEG, WebP, HEIF
|
|
340
|
+
**Images (up to 50MB):**
|
|
341
|
+
- PNG, JPEG, WebP, HEIF/HEIC, GIF
|
|
342
|
+
- BMP, TIFF (legacy formats)
|
|
230
343
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
344
|
+
### AI Models
|
|
345
|
+
|
|
346
|
+
| Model | Best For | Speed | Detail |
|
|
347
|
+
|-------|----------|-------|--------|
|
|
348
|
+
| `sonar` | Quick answers, general queries | ⚡ Fast | Standard detail |
|
|
349
|
+
| `sonar-pro` | Detailed analysis, research | 🚀 Fast | Enhanced detail |
|
|
350
|
+
| `sonar-reasoning` | Mathematical reasoning, logic | 🐢 Moderate | Step-by-step |
|
|
351
|
+
| `sonar-deep-research` | Comprehensive research with web context | 🐌 Slow | Maximum detail |
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## 💻 Programmatic Use
|
|
356
|
+
|
|
357
|
+
### TypeScript API
|
|
358
|
+
|
|
359
|
+
Use the toolkit directly in TypeScript when embedding into agents or services.
|
|
360
|
+
|
|
361
|
+
```ts
|
|
362
|
+
import { PerplexitySearchTool } from 'pplx-zero';
|
|
363
|
+
|
|
364
|
+
// Initialize the search tool
|
|
365
|
+
const tool = new PerplexitySearchTool();
|
|
235
366
|
|
|
236
|
-
|
|
237
|
-
|
|
367
|
+
// Single search query
|
|
368
|
+
const result = await tool.search({
|
|
369
|
+
query: "TypeScript best practices",
|
|
370
|
+
model: "sonar-pro",
|
|
371
|
+
maxResults: 5
|
|
372
|
+
});
|
|
238
373
|
|
|
239
|
-
|
|
240
|
-
pplx --attach document.txt --attach-image chart.png "Analyze this data"
|
|
374
|
+
console.log(result);
|
|
241
375
|
```
|
|
242
376
|
|
|
243
|
-
###
|
|
377
|
+
### Batch Processing
|
|
244
378
|
|
|
245
|
-
```
|
|
379
|
+
```ts
|
|
246
380
|
import { PerplexitySearchTool } from 'pplx-zero';
|
|
247
381
|
|
|
248
382
|
const tool = new PerplexitySearchTool();
|
|
249
383
|
|
|
250
|
-
|
|
384
|
+
// Batch search with custom configuration
|
|
385
|
+
const batchResult = await tool.runBatch({
|
|
251
386
|
version: "1.0.0",
|
|
252
|
-
requests: [
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
387
|
+
requests: [
|
|
388
|
+
{
|
|
389
|
+
op: "search",
|
|
390
|
+
args: {
|
|
391
|
+
query: "TypeScript best practices",
|
|
392
|
+
maxResults: 5,
|
|
393
|
+
model: "sonar-pro"
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
op: "search",
|
|
398
|
+
args: {
|
|
399
|
+
query: "React performance optimization",
|
|
400
|
+
maxResults: 3,
|
|
401
|
+
model: "sonar"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
],
|
|
405
|
+
options: {
|
|
406
|
+
concurrency: 3,
|
|
407
|
+
timeoutMs: 30000
|
|
408
|
+
}
|
|
256
409
|
});
|
|
257
410
|
|
|
258
|
-
console.log(
|
|
411
|
+
console.log('Batch results:', batchResult);
|
|
259
412
|
```
|
|
260
413
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
### Simplified Options (Everyday Usage)
|
|
264
|
-
|
|
265
|
-
| Option | Short | Type | Default | Description |
|
|
266
|
-
|--------|-------|------|---------|-------------|
|
|
267
|
-
| `--file` | `-f` | string | - | Attach document (PDF, DOC, DOCX, TXT, RTF, MD) |
|
|
268
|
-
| `--image` | `-i` | string | - | Attach image (PNG, JPEG, WebP, HEIF, HEIC, GIF) |
|
|
269
|
-
| `--format` | `-o` | string | json | Output format: json|jsonl |
|
|
270
|
-
| `--model` | `-m` | string | sonar | AI model: sonar, sonar-pro, sonar-deep-research, sonar-reasoning |
|
|
271
|
-
| `--version` | `-v` | boolean | - | Show version |
|
|
272
|
-
| `--help` | `-h` | boolean | - | Show basic help |
|
|
273
|
-
|
|
274
|
-
### Update Commands
|
|
275
|
-
|
|
276
|
-
| Command | Options | Description |
|
|
277
|
-
|---------|---------|-------------|
|
|
278
|
-
| `pplx update` | `--check` | Check for available updates |
|
|
279
|
-
| `pplx update` | `--auto` | Install available updates automatically |
|
|
280
|
-
| `pplx version` | `--check-updates` | Show version and check for updates |
|
|
281
|
-
| `pplx version` | `--verbose` | Show detailed version information |
|
|
282
|
-
|
|
283
|
-
### Advanced Options (Power Users)
|
|
284
|
-
|
|
285
|
-
| Option | Short | Type | Default | Description |
|
|
286
|
-
|--------|-------|------|---------|-------------|
|
|
287
|
-
| `--input` | `-I` | string | - | Read batch requests from JSON file |
|
|
288
|
-
| `--stdin` | `-s` | boolean | false | Read JSONL requests from stdin |
|
|
289
|
-
| `--concurrency` | `-c` | number | 5 | Max concurrent requests (1-20) |
|
|
290
|
-
| `--timeout` | `-t` | number | 30000 | Request timeout in ms (1000-300000) |
|
|
291
|
-
| `--workspace` | `-w` | string | - | Workspace directory for sandboxing |
|
|
292
|
-
| `--attach` | - | string[] | - | Attach document files (multiple) |
|
|
293
|
-
| `--attach-image` | - | string[] | - | Attach image files (multiple) |
|
|
294
|
-
| `--async` | - | boolean | false | Process requests asynchronously |
|
|
295
|
-
| `--webhook` | - | string | - | Webhook URL for async notifications |
|
|
296
|
-
|
|
|
297
|
-
|
|
298
|
-
### Quick Reference
|
|
414
|
+
### Advanced Usage with Error Handling
|
|
299
415
|
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
pplx -f doc.pdf -m sonar-pro "analyze this"
|
|
416
|
+
```ts
|
|
417
|
+
import { PerplexitySearchTool } from 'pplx-zero';
|
|
303
418
|
|
|
304
|
-
|
|
305
|
-
|
|
419
|
+
async function searchWithRetry(query: string, maxRetries = 3) {
|
|
420
|
+
const tool = new PerplexitySearchTool();
|
|
421
|
+
|
|
422
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
423
|
+
try {
|
|
424
|
+
const result = await tool.search({
|
|
425
|
+
query,
|
|
426
|
+
model: "sonar-pro",
|
|
427
|
+
maxResults: 5
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
return result;
|
|
431
|
+
} catch (error) {
|
|
432
|
+
if (attempt === maxRetries) {
|
|
433
|
+
throw new Error(`Search failed after ${maxRetries} attempts: ${error}`);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Exponential backoff
|
|
437
|
+
await new Promise(resolve => setTimeout(resolve, Math.pow(2, attempt) * 1000));
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
306
441
|
|
|
307
|
-
|
|
308
|
-
|
|
442
|
+
// Usage
|
|
443
|
+
searchWithRetry("latest AI trends")
|
|
444
|
+
.then(result => console.log(result))
|
|
445
|
+
.catch(error => console.error(error));
|
|
309
446
|
```
|
|
310
447
|
|
|
311
|
-
|
|
448
|
+
---
|
|
312
449
|
|
|
313
|
-
|
|
314
|
-
- `sonar-pro` - Detailed, comprehensive responses
|
|
315
|
-
- `sonar-deep-research` - In-depth research with web search
|
|
316
|
-
- `sonar-reasoning` - Step-by-step logical reasoning
|
|
450
|
+
## 🛠️ Troubleshooting
|
|
317
451
|
|
|
318
|
-
|
|
452
|
+
### Common Issues & Solutions
|
|
319
453
|
|
|
320
|
-
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
"successful": 1,
|
|
328
|
-
"failed": 0,
|
|
329
|
-
"totalDuration": 572
|
|
330
|
-
},
|
|
331
|
-
"results": [...]
|
|
332
|
-
}
|
|
454
|
+
#### API Key Problems
|
|
455
|
+
```bash
|
|
456
|
+
# Error: "API key not found"
|
|
457
|
+
export PERPLEXITY_API_KEY="your-api-key"
|
|
458
|
+
|
|
459
|
+
# Verify key is set
|
|
460
|
+
echo $PERPLEXITY_API_KEY
|
|
333
461
|
```
|
|
334
462
|
|
|
335
|
-
|
|
463
|
+
#### File Attachment Issues
|
|
336
464
|
```bash
|
|
337
|
-
|
|
465
|
+
# Error: "File too large" (files must be < 50MB)
|
|
466
|
+
ls -lh your-file.pdf
|
|
467
|
+
|
|
468
|
+
# Supported formats check
|
|
469
|
+
file your-document.pdf # Should show PDF format
|
|
338
470
|
```
|
|
339
|
-
Each result printed as a separate JSON line for real-time processing.
|
|
340
471
|
|
|
341
|
-
|
|
472
|
+
#### Network/Timeout Issues
|
|
473
|
+
```bash
|
|
474
|
+
# Increase timeout for complex queries
|
|
475
|
+
pplx -t 60000 "complex research question"
|
|
342
476
|
|
|
477
|
+
# Check internet connectivity
|
|
478
|
+
curl -I https://api.perplexity.ai
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### Permission Issues
|
|
343
482
|
```bash
|
|
344
|
-
#
|
|
345
|
-
|
|
346
|
-
cd pplx-zero
|
|
347
|
-
bun install && bun run build
|
|
483
|
+
# Permission denied during installation
|
|
484
|
+
npm install -g pplx-zero --unsafe-perm
|
|
348
485
|
|
|
349
|
-
#
|
|
350
|
-
|
|
486
|
+
# Or use npx to avoid global installation
|
|
487
|
+
npx pplx-zero "your query"
|
|
488
|
+
```
|
|
351
489
|
|
|
352
|
-
|
|
353
|
-
bun run typecheck
|
|
490
|
+
### Debug Mode
|
|
354
491
|
|
|
355
|
-
|
|
356
|
-
|
|
492
|
+
```bash
|
|
493
|
+
# Enable verbose output for debugging
|
|
494
|
+
DEBUG=pplx:* pplx "your query"
|
|
357
495
|
|
|
358
|
-
#
|
|
359
|
-
|
|
496
|
+
# Check configuration
|
|
497
|
+
pplx --version
|
|
498
|
+
pplx update --check
|
|
360
499
|
```
|
|
361
500
|
|
|
362
|
-
|
|
501
|
+
### Performance Tips
|
|
363
502
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
503
|
+
| Scenario | Recommended Settings |
|
|
504
|
+
|----------|---------------------|
|
|
505
|
+
| **Quick searches** | Default settings (sonar model) |
|
|
506
|
+
| **Deep research** | `-m sonar-deep-research -t 60000` |
|
|
507
|
+
| **Batch processing** | `-c 10 -t 45000` |
|
|
508
|
+
| **File analysis** | `-m sonar-pro -t 60000` |
|
|
509
|
+
| **Real-time queries** | `-m sonar -n 3` |
|
|
369
510
|
|
|
370
|
-
|
|
511
|
+
---
|
|
371
512
|
|
|
372
|
-
|
|
373
|
-
- Input validation and sanitization
|
|
374
|
-
- Request timeout protection
|
|
375
|
-
- Error information filtering
|
|
376
|
-
- No external dependencies beyond core runtime
|
|
513
|
+
## 📚 Additional Resources
|
|
377
514
|
|
|
378
|
-
|
|
515
|
+
- **GitHub Repository**: [github.com/codewithkenzo/pplx-zero](https://github.com/codewithkenzo/pplx-zero)
|
|
516
|
+
- **Bug Reports & Issues**: [GitHub Issues](https://github.com/codewithkenzo/pplx-zero/issues)
|
|
517
|
+
- **Perplexity API Documentation**: [docs.perplexity.ai](https://docs.perplexity.ai)
|
|
518
|
+
- **Model Comparison**: Detailed model comparison in the [AI Models](#ai-models) section above
|
|
379
519
|
|
|
380
|
-
|
|
520
|
+
---
|
|
381
521
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
TIMEOUT_ERROR = "TIMEOUT_ERROR",
|
|
388
|
-
NETWORK_ERROR = "NETWORK_ERROR",
|
|
389
|
-
RATE_LIMIT_ERROR = "RATE_LIMIT_ERROR",
|
|
390
|
-
UNEXPECTED_ERROR = "UNEXPECTED_ERROR"
|
|
391
|
-
}
|
|
392
|
-
```
|
|
522
|
+
### Quick Reference Commands
|
|
523
|
+
|
|
524
|
+
```bash
|
|
525
|
+
# Show all available options
|
|
526
|
+
pplx --help
|
|
393
527
|
|
|
394
|
-
|
|
528
|
+
# Check for updates
|
|
529
|
+
pplx update --check
|
|
395
530
|
|
|
396
|
-
|
|
531
|
+
# Auto-update
|
|
532
|
+
pplx update --auto
|
|
397
533
|
|
|
398
|
-
|
|
534
|
+
# Show version
|
|
535
|
+
pplx --version
|
|
536
|
+
|
|
537
|
+
# Search history
|
|
538
|
+
pplx history 10
|
|
399
539
|
|
|
400
|
-
|
|
540
|
+
# Quick test
|
|
541
|
+
pplx "test query"
|
|
542
|
+
```
|
|
401
543
|
|
|
402
544
|
---
|
|
403
545
|
|
|
404
|
-
|
|
546
|
+
*Built with ❤️ using [Bun](https://bun.sh) and powered by [Perplexity AI](https://www.perplexity.ai)*
|