npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

perplexity-cli

v1.0.0

Published

A CLI tool to interact with the Perplexity API from your terminal

Readme

perplexity-cli

A command-line interface (CLI) app that allows you to run queries using Perplexity's API directly from your terminal.

Installation

Local Installation

# Clone the repository
git clone https://github.com/yourusername/perplexity-cli.git
cd perplexity-cli

# Install dependencies
npm install

# Link the CLI globally
npm link

Global Installation (once published)

npm install -g perplexity-cli

Or run directly without installation:

npx perplexity-cli

Setup

Before using the CLI, you need to set your Perplexity API key:

perplexity-cli set-key YOUR_API_KEY_HERE

You can get your API key from the Perplexity API Settings page.

Usage

Running Queries

perplexity-cli query "What is the capital of France?"

Stream the Response in Real-Time

perplexity-cli query "Explain quantum computing" --stream

Save the Response to a File

perplexity-cli query "Write a short story about AI" --output story.txt

Specify a Different Model

perplexity-cli query "Explain quantum computing" --model sonar-large

View Query History

perplexity-cli history

View Available Models

perplexity-cli models

View Your API Key (Masked)

perplexity-cli view-key

Clear Your API Key

perplexity-cli clear-key

Available Commands

  • set-key <key>: Set your Perplexity API key
  • view-key: View your currently set API key (masked)
  • query <question>: Send a query to the Perplexity API
  • models: List available Perplexity API models
  • history: View history of recent queries
  • clear-key: Clear your stored API key

Options for Query Command

  • -m, --model <model>: Specify the model to use for your query (default: sonar)
  • -s, --stream: Stream the response as it is generated
  • -o, --output <file>: Save the response to a file
  • -h, --help: Display help information
  • -V, --version: Display version information

Models

The CLI supports various Perplexity models:

  • sonar: Default, balanced speed and capability
  • sonar-small: Fastest, least capable
  • sonar-medium: Good balance of speed and capability
  • sonar-large: Most capable, slower
  • codellama-70b: Specialized for code generation
  • mistral-7b: Open-source model
  • mixtral-8x7b: Mixture of experts model
  • llama-3-70b: Meta's latest model

License

MIT