/perplexity-cli

🧠 A simple command-line client for the Perplexity API. Ask questions and receive answers directly from the terminal! 🚀🚀🚀

Primary LanguagePythonMIT LicenseMIT

Perplexity CLI

Perplexity CLI is a command-line interface for interacting with the Perplexity API. This CLI tool uses the Click library for building commands.

Installation

You can install Perplexity CLI directly from the GitHub repository:

python pip install git+https://github.com/chriscarrollsmith/perplexity-cli.git

If you are installing on a system where you don't have administrative privileges, you can install the tool in your user environment with the --user flag:

python pip install --user git+https://github.com/chriscarrollsmith/perplexity-cli.git

After a user installation, make sure that your local binary directory is in your PATH. For example, add the following line to your shell configuration file (e.g. .bashrc or .zshrc):

export PATH="$HOME/.local/bin:$PATH"

Configuration

The tool requires an API key to interact with the Perplexity API. You can provide the API key using the --api-key option or by setting it as an environment variable:

export PERPLEXITY_API_KEY="your_api_key_here"

To permanently set the API key, add the above command to your .bashrc or .zshrc file:

echo "export PERPLEXITY_API_KEY='your_api_key_here'" >> ~/.bashrc

Usage

Run the CLI by providing a query and desired options:

perplexity "Your query here" [options]

Options

  • -v, --verbose – Enable debug mode.
  • -u, --usage – Show usage details.
  • -c, --citations – Show citations.
  • -g, --glow – Enable glow display mode.
  • -a, --api-key – Specify the API key directly.
  • -m, --model – Select the model to use (default is sonar-pro).
    Available models: sonar-reasoning-pro, sonar-reasoning, sonar-pro, sonar.

Example

perplexity "What is the capital of France?" -v -c -u -m sonar-pro

Repository

For the latest updates, to file issues, or to contribute, please visit the GitHub repository at:
https://github.com/chriscarrollsmith/perplexity-cli


### Explanation

- **Installation Section:** Updated to instruct users to install directly from the GitHub repository.
- **Repository Link:** Added a link to the GitHub repo for quick access to source code and further updates.
- **Usage and Options:** Provided clear instructions on how to run the CLI along with a full list of options available.