Skip to content

naelmohammad/pplx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pplx & pplxpro

Perplexity CLI Agent
A command-line interface for Perplexity AI.


Features

  • Query Perplexity AI directly from your terminal
  • Supports multiple models (e.g., sonar-pro, mistral-7b-instruct)
  • Simple, scriptable, and fast
  • pplx - supports default models for non-pro perplexity users.
  • pplxpro - supports additional models for perplexity pro users.

Supported Models as of 05/19/2025

  • sonar-small-online
  • sonar-medium-online
  • sonar-small-chat
  • sonar-medium-chat
  • mistral-7b-instruct
  • llama-3.1-sonar-small-128k-online
  • llama-3.1-sonar-large-128k-online
  • sonar-pro
  • gpt-4-omni
  • claude-3.5-sonnet
  • gemini-2.0-flash

Requirements

  • macOS Sequoia (or similar Unix-like system)
  • Python 3.6 or later
  • git
  • Perplexity API key
  • Perlexity API URL endpoint

Installation

1. Clone the Repository

git clone https://github.com/naelmohammad/pplx.git
cd pplx

2. (Recommended) Create a Virtual Environment

python3 -m venv venv
source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Install the CLI Script

mv pplx > ~/.local/bin/pplx
mv pplxpro > ~/.local/bin/pplxpro

chmod +x ~/.local/bin/pplx
chmod +x ~/.local/bin/pplxpro

5. Add to PATH

Ensure ~/.local/bin is in your PATH.
For bash:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc

For zsh (default on recent macOS):

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc

6. Set Your Perplexity API Key

Generate your API key at: Perplexity API Docs

Export your API key as an environment variable:

For bash:

echo 'export PPLX_API_KEY="your-api-key"' >> ~/.bashrc
echo 'export PPLX_API_URL="your-api-URL-endpoint"' >> ~/.bashrc

For zsh:

echo 'export PPLX_API_KEY="your-api-key"' >> ~/.zshrc
echo 'export PPLX_API_URL="your-api-URL-endpoint"' >> ~/.zshrc

Reload your shell configuration:

source ~/.bashrc    # or source ~/.zshrc

Usage

Ask a question from your terminal:

pplx "What is the purpose of epoch format?"
pplxpro "What is the purpose of epoch format?"

Specify a model:

pplx -m sonar-pro "Explain Moore's Law"
pplxpro -m llama-3.1-sonar-small-128k-online "What is Moore's Law?"

Show help and options:

pplx -h
pplxpro -h

CLI Options

usage: pplx [-h] [-m {sonar-pro,mistral-7b-instruct,sonar-small,sonar-medium}] query [query ...]

positional arguments:
  query                 Your search query (no quotes needed)

options:
  -h, --help            Show this help message and exit
  -m, --model           Model to use (default: sonar-pro)
usage: pplxpro [-h]  [-m {sonar-small-online,sonar-medium-online,sonar-small-chat,sonar-medium-chat,mistral-7b-instruct,llama-3.1-sonar-small-128k-online,llama-3.1-sonar-large-128k-online,sonar-pro,gpt-4-omni,claude-3.5-sonnet,gemini-2.0-flash}] query [query ...]


Troubleshooting

  • Ensure your API key is set and your shell is reloaded.
  • Make sure ~/.local/bin is in your PATH.
  • For issues, open an issue on GitHub.

License

GPL V3 License


Happy querying!

About

Perplexity CLI Agent A command-line interface for Perplexity AI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published