Skip to content

Latest commit

 

History

History
227 lines (159 loc) · 6.69 KB

File metadata and controls

227 lines (159 loc) · 6.69 KB

Perplexity CLI

License Node.js perlexity_cli_screenshot

A command-line interface for interacting with Perplexity AI's Sonar models directly from your terminal.

🚀 Why Perplexity CLI?

  • 🔍 AI-Powered Research: Access to Perplexity's advanced search and reasoning capabilities
  • 📚 Citation Support: Get responses backed by real sources and citations
  • 🌐 Real-Time Information: Leverage up-to-date web search for current information
  • 💡 Advanced Reasoning: Utilize Sonar models optimized for complex analysis
  • 💻 Terminal-First: Designed for developers who live in the command line
  • 🔧 Tool Integration: Built-in web search, fetch, and multi-tool workflows

Features

  • Interactive Mode: Real-time streaming responses with beautiful terminal UI
  • Fast & Efficient: Optimized for developer productivity
  • 🎨 Beautiful Themes: Dark blue Perplexity theme with customizable alternatives
  • 📝 Command History: Navigate through previous prompts with arrow keys
  • 🔌 MCP Support: Model Context Protocol support for custom integrations
  • 📊 Citation Tracking: View sources and citations for AI responses
  • 🔄 Checkpoint System: Save and resume conversations

Quick Start

Prerequisites

Installation

npm install -g @perplexity-cli/perplexity-cli

Configuration

Set your Perplexity API key as an environment variable:

export PERPLEXITY_API_KEY=your_api_key_here

Or start Perplexity CLI and enter your api key there.

auth

Basic Usage

Interactive mode

Start in current directory

perplexity

Include multiple directories

perplexity --include-directories ../lib,../docs

Use specific model

perplexity -m sonar-pro

Available Models

  • sonar-pro: Advanced model for complex reasoning and research
  • sonar: Balanced performance for general use
  • sonar-reasoning-pro: Precise reasoning offering Chain of Thought
  • sonar-deep-research: Expert level research model

Non-interactive mode for scripts

Get a simple text response:

perplexity -p "Explain the architecture of this codebase"

For more advanced scripting, including how to parse JSON and handle errors, use the --output-format json flag to get structured output:

perplexity -p "Explain the architecture of this codebase" --output-format json

For real-time event streaming (useful for monitoring long-running operations), use --output-format stream-json to get newline-delimited JSON events:

perplexity -p "Run tests and deploy" --output-format stream-json

📚 Documentation

Getting Started

Core Features

Tools & Extensions

Advanced Topics

Troubleshooting & Support

  • Troubleshooting Guide - Common issues and solutions.
  • FAQ - Frequently asked questions.
  • Use /bug command to report issues directly from the CLI.

Using MCP Servers

Configure MCP servers in ~/.perplexity/settings.json to extend Perplexity CLI with custom tools:

> @github List my open pull requests
> @slack Send a summary of today's commits to #dev channel
> @database Run a query to find inactive users

See the MCP Server Integration guide for setup instructions.

Development

Building from Source

# Download latest version of node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"

# Download and install Node.js:
nvm install 24

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

# Install dependencies
npm install

# Build
npm run build

# Run locally
npm start

Running Tests

npm test

Security

⚠️ Never commit your API key to version control. Always use environment variables or the .env file (which should be in .gitignore).

License

Apache-2.0 License - See LICENSE for details.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.


Built with ❤️ using the architecture from Gemini CLI