Command line interface for Perplexity AI API
Project description
Perplexity Search CLI
A command line interface for interacting with the Perplexity AI API.
Features
- Query the Perplexity API from command line
- Accepts input from arguments or stdin
- Supports API key from environment variable or command line
- Source citations with inline cross-references (enabled by default)
- Optionally save full JSON responses to file
- Clean, formatted output
- Claude Code MCP integration (
PPWebSearchtool, one-command setup)
Installation
Install directly from PyPI:
pip install perplexity-search-cli
After installation, you will see instructions to register it as a Claude Code MCP server.
From source
git clone https://github.com/yourusername/perplexity-search-cli.git
cd perplexity-search-cli
pip install .
Development install
git clone https://github.com/yourusername/perplexity-search-cli.git
cd perplexity-search-cli
pip install -e .
Usage
Basic query:
perplexity-search-cli -p "Your question" -k YOUR_API_KEY
Using environment variable:
export PPLX_API_KEY=YOUR_API_KEY
perplexity-search-cli -p "Your question"
Pipe input from stdin:
echo "Your question" | perplexity-search-cli -k YOUR_API_KEY
Save full JSON response:
perplexity-search-cli -p "Your question" -k YOUR_API_KEY -o response.json
Options
-h, --help show help message
-p PROMPT, --prompt PROMPT
Prompt to send to Perplexity API
-k API_KEY, --api-key API_KEY
Perplexity API key (or set PPLX_API_KEY env var)
-o OUTPUT, --output OUTPUT
Path to save full JSON response
-n, --no-citations Disable printing source citations
--params PARAMS Additional API parameters as JSON string
Citations
By default, source URLs referenced in the response are printed below the content:
The speed of light is approximately 299,792 km/s [1] in a vacuum [2].
Sources:
[1] https://en.wikipedia.org/wiki/Speed_of_light
[2] https://physics.nist.gov/...
To disable citations:
perplexity-search-cli -p "Your question" --no-citations
Example with Additional Parameters
perplexity-search-cli -p "Your question" -k YOUR_API_KEY \
--params '{"temperature": 0.7, "max_tokens": 100}'
Claude Code MCP Integration
This package can be registered as a Claude Code MCP server, exposing a PPWebSearch tool.
Register with Claude Code
export PPLX_API_KEY=YOUR_API_KEY
perplexity-install-claude-mcp
This registers the MCP server globally for the current user. Re-run any time to update the registration.
Verify with claude mcp list or /mcp inside Claude Code.
Requirements
- Python 3.6+
- requests
- mcp[cli]
Publishing New Versions
- Update version in pyproject.toml
- Commit changes
- Create a new git tag:
git tag vX.Y.Z # match version in pyproject.toml
git push origin vX.Y.Z
The GitHub Action will automatically:
- Build the package
- Publish to PyPI when tags are pushed
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file perplexity_search_cli-1.0.11.tar.gz.
File metadata
- Download URL: perplexity_search_cli-1.0.11.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cf0819cd2b385272ead7e662941999922e0fc764ccc9617c5d9a7b5fec82b2c
|
|
| MD5 |
9179a3843d83c20c593a6dd0535ea039
|
|
| BLAKE2b-256 |
bd62a404ed013bc37b86f8d4597c81f85b236047ca322e04b283e05bd1d53c41
|
File details
Details for the file perplexity_search_cli-1.0.11-py3-none-any.whl.
File metadata
- Download URL: perplexity_search_cli-1.0.11-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4179091e0d1b4ceb7edfacf556adf67f90f2e410e49ecd242ec68da28820f0b1
|
|
| MD5 |
de9e92bb391cc7f52e88aba71918fef0
|
|
| BLAKE2b-256 |
86c7c7384695134d30a4e02b4dbebc5e891f9cd54b2958685a4f4dde8a2bd6d1
|