Skip to content

An open-source AI agent that brings the real-time intelligence of Perplexity AI to your command line, seamlessly integrating powerful models and tools into your daily workflow.

License

Notifications You must be signed in to change notification settings

noQuli/perplexity-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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

About

An open-source AI agent that brings the real-time intelligence of Perplexity AI to your command line, seamlessly integrating powerful models and tools into your daily workflow.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages