A command-line tool for searching and exporting information using the Perplexity AI API.
Version: 1.0.0
Last Updated: 2025-03-04
Maintained by: Jiawei (Jack) Tan
- Search for information using Perplexity AI directly from your terminal
- Support for all Perplexity AI models (sonar, sonar-pro, etc.)
- Export search results to various formats (Markdown, Text, PDF)
- Debug mode for troubleshooting
- Raw response viewing for development
- Secure API key management and verification
-
Download the script:
curl -O https://raw.githubusercontent.com/username/repo/main/pplx_search.sh
-
Make it executable:
chmod +x pplx_search.sh
-
(Optional) Move to your PATH for system-wide access:
sudo mv pplx_search.sh /usr/local/bin/pplx
curl
- Required for API communicationjq
- Recommended for better JSON parsing and formatted output- For PDF export (one of the following):
pandoc
(recommended)wkhtmltopdf
enscript
+ps2pdf
Run the configuration command to set up your API key:
pplx configure
Your API key will be stored in ~/.pplx_search.conf
with secure permissions (600).
# Search for information
pplx search "your search query"
# Search using a specific model
pplx search -m sonar-pro "your search query"
# View available models
pplx models
# Verify API key
pplx verify
# Get help
pplx help
# Export to Markdown (default)
pplx export "your search query"
# Export as text file
pplx export -f txt "your search query"
# Export as PDF
pplx export -f pdf "your search query"
# Specify output filename
pplx export -o filename.md "your search query"
# Combine options
pplx export -f pdf -o research.pdf -m sonar-pro "detailed search query"
# Debug mode (verbose output)
pplx debug "your search query"
# View raw API response
pplx raw "your search query"
- Markdown (.md) - Default format with structured sections
- Text (.txt) - Plain text format with simple formatting
- PDF (.pdf) - PDF document (requires additional tools)
Run pplx models
for the complete and up-to-date list. Current models include:
- sonar (default)
- sonar-pro
- sonar-deep-research
- sonar-reasoning
- sonar-reasoning-pro
- r1-1776
Install one of the supported PDF conversion tools:
# Install pandoc (recommended)
sudo apt install pandoc # Debian/Ubuntu
brew install pandoc # macOS
# Or wkhtmltopdf
sudo apt install wkhtmltopdf # Debian/Ubuntu
brew install wkhtmltopdf # macOS
If you receive "401 Authorization Required" errors:
- Verify your API key with
pplx verify
- Ensure your subscription is active
- Run
pplx configure
to update your key
Install jq
for better formatting and to see sources:
sudo apt install jq # Debian/Ubuntu
brew install jq # macOS
This project is licensed under the MIT License - see the LICENSE file for details.
- Perplexity AI for providing the API
- Contributors and testers who helped improve this tool
Documentation generated on 2025-03-04 15:25:42 UTC