pplx-cli 1.0.0

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +182 -0
  3. package/dist/index.js +5842 -0
  4. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adarsh Dubey
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # pplx-cli
2
+
3
+ A powerful CLI tool for the [Perplexity AI API](https://docs.perplexity.ai/) - search the web and chat with AI from your terminal.
4
+
5
+ ## Features
6
+
7
+ - 🔍 **Web Search** - Search the web with advanced filtering options
8
+ - 💬 **AI Chat** - Chat with Perplexity's AI models with web-grounded responses
9
+ - 🌊 **Streaming** - Real-time streaming responses
10
+ - 📚 **Citations** - See sources for AI-generated responses
11
+ - 🎯 **Multiple Models** - Support for Sonar, Sonar Pro, and Reasoning models
12
+ - ⚙️ **Easy Configuration** - Simple API key management
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ # Using npm
18
+ npm install -g pplx-cli
19
+
20
+ # Using bun
21
+ bun install -g pplx-cli
22
+
23
+ # Using yarn
24
+ yarn global add pplx-cli
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ 1. Get your API key from [Perplexity API Portal](https://perplexity.ai/account/api)
30
+
31
+ 2. Configure the CLI:
32
+ ```bash
33
+ pplx config set-key pplx-xxxxxxxxxxxxxxxx
34
+ ```
35
+
36
+ 3. Start asking questions:
37
+ ```bash
38
+ pplx ask "What are the latest developments in AI?"
39
+ ```
40
+
41
+ ## Commands
42
+
43
+ ### `pplx config`
44
+
45
+ Manage your configuration.
46
+
47
+ ```bash
48
+ # Save your API key
49
+ pplx config set-key <api-key>
50
+
51
+ # Show current configuration
52
+ pplx config show
53
+
54
+ # Clear configuration
55
+ pplx config clear
56
+ ```
57
+
58
+ ### `pplx ask`
59
+
60
+ Ask a single question to Perplexity AI.
61
+
62
+ ```bash
63
+ # Basic usage
64
+ pplx ask "What is the weather in Tokyo?"
65
+
66
+ # Use a specific model
67
+ pplx ask "Explain quantum computing" --model sonar-pro
68
+
69
+ # Stream the response in real-time
70
+ pplx ask "Latest tech news" --stream
71
+
72
+ # Filter by recency
73
+ pplx ask "Breaking news" --recency hour
74
+
75
+ # Filter by domain
76
+ pplx ask "Climate research" --domain nature.com --domain science.org
77
+
78
+ # Output as JSON
79
+ pplx ask "Hello world" --json
80
+
81
+ # Hide citations
82
+ pplx ask "Quick question" --no-citations
83
+
84
+ # Custom system prompt
85
+ pplx ask "Summarize this topic" --system "You are a concise summarizer"
86
+ ```
87
+
88
+ **Options:**
89
+ - `-m, --model <model>` - Model to use (sonar, sonar-pro, sonar-reasoning, sonar-reasoning-pro)
90
+ - `-s, --stream` - Stream the response in real-time
91
+ - `-j, --json` - Output raw JSON response
92
+ - `-c, --citations` - Show source citations (default: true)
93
+ - `--no-citations` - Hide source citations
94
+ - `-r, --recency <recency>` - Filter by recency (hour, day, week, month, year)
95
+ - `-d, --domain <domains...>` - Filter by domain(s)
96
+ - `--system <prompt>` - Custom system prompt
97
+
98
+ ### `pplx search`
99
+
100
+ Search the web using Perplexity.
101
+
102
+ ```bash
103
+ # Basic search
104
+ pplx search "climate change research"
105
+
106
+ # Academic search
107
+ pplx search "machine learning papers" --mode academic
108
+
109
+ # Limit results
110
+ pplx search "tech news" --limit 5
111
+
112
+ # Filter by recency
113
+ pplx search "breaking news" --recency day
114
+
115
+ # Filter by domain
116
+ pplx search "AI news" --domain techcrunch.com
117
+
118
+ # Output as JSON
119
+ pplx search "query" --json
120
+ ```
121
+
122
+ **Options:**
123
+ - `-l, --limit <number>` - Maximum number of results (default: 10)
124
+ - `-m, --mode <mode>` - Search mode (web, academic, sec)
125
+ - `-r, --recency <recency>` - Filter by recency (hour, day, week, month, year)
126
+ - `-d, --domain <domains...>` - Filter by domain(s)
127
+ - `-j, --json` - Output raw JSON response
128
+
129
+ ### `pplx chat`
130
+
131
+ Start an interactive chat session.
132
+
133
+ ```bash
134
+ # Start chat
135
+ pplx chat
136
+
137
+ # Use a specific model
138
+ pplx chat --model sonar-pro
139
+
140
+ # With custom system prompt
141
+ pplx chat --system "You are a helpful coding assistant"
142
+ ```
143
+
144
+ **In-chat commands:**
145
+ - `/clear` - Clear conversation history
146
+ - `/exit` or `/quit` - Exit the chat
147
+ - `/help` - Show help
148
+
149
+ **Options:**
150
+ - `-m, --model <model>` - Model to use
151
+ - `--system <prompt>` - Custom system prompt
152
+ - `-r, --recency <recency>` - Filter by recency
153
+ - `-d, --domain <domains...>` - Filter by domain(s)
154
+
155
+ ## Available Models
156
+
157
+ | Model | Description |
158
+ |-------|-------------|
159
+ | `sonar` | Fast, cost-effective model (default) |
160
+ | `sonar-pro` | Advanced model with better quality |
161
+ | `sonar-reasoning` | Model with reasoning capabilities |
162
+ | `sonar-reasoning-pro` | Advanced reasoning model |
163
+
164
+ ## Environment Variables
165
+
166
+ - `PERPLEXITY_API_KEY` - Your Perplexity API key (alternative to config file)
167
+
168
+ The config file takes precedence over the environment variable.
169
+
170
+ ## Configuration File
171
+
172
+ The configuration is stored at `~/.config/pplx-cli/config.json`.
173
+
174
+ ## License
175
+
176
+ MIT
177
+
178
+ ## Links
179
+
180
+ - [Perplexity API Documentation](https://docs.perplexity.ai/)
181
+ - [GitHub Repository](https://github.com/inclinedadarsh/pplx-cli)
182
+ - [Report Issues](https://github.com/inclinedadarsh/pplx-cli/issues)