A command-line interface for interacting with Perplexity AI's Sonar models directly from your terminal.
- π 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
- οΏ½ 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
- Node.js 20.0.0 or higher
- A Perplexity API key (get one at https://www.perplexity.ai/settings/api)
- macOS, Linux or Windows
npm install -g @perplexity-cli/perplexity-cliSet your Perplexity API key as an environment variable:
export PERPLEXITY_API_KEY=your_api_key_hereOr start Perplexity CLI and enter your api key there.
perplexityperplexity --include-directories ../lib,../docsperplexity -m sonar-pro- 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
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 jsonFor 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- Quickstart Guide - Get up and running quickly.
- Authentication Setup - Detailed auth configuration.
- Configuration Guide - Settings and customization.
- Keyboard Shortcuts - Productivity tips.
- Commands Reference - All slash commands
(
/help,/chat, etc). - Custom Commands - Create your own
reusable commands.
- Context Files (PERPLEXITY.md) - Provide persistent context to Perplexity CLI.
- Checkpointing - Save and resume conversations.
- Token Caching - Optimize token usage.
- Built-in Tools Overview
- MCP Server Integration - Extend with custom tools.
- Custom Extensions - Build and share your own commands.
- Headless Mode (Scripting) - Use Perplexity CLI in automated workflows.
- Architecture Overview - How Perplexity CLI works.
- IDE Integration - VS Code companion.
- Sandboxing & Security - Safe execution environments.
- Trusted Folders - Control execution policies by folder.
- Telemetry & Monitoring - Usage tracking.
- Tools API Development - Create custom tools.
- Local development - Local development tooling.
- Troubleshooting Guide - Common issues and solutions.
- FAQ - Frequently asked questions.
- Use
/bugcommand to report issues directly from the CLI.
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.
# 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 startnpm test.env file (which should be in .gitignore).
Apache-2.0 License - See LICENSE for details.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Built with β€οΈ using the architecture from Gemini CLI

