zed/extensions/perplexity
Piotr Osiewicz c9534e8025
chore: Use workspace fields for edition and publish (#23291)
This prepares us for an upcoming bump to Rust 2024 edition.

Release Notes:

- N/A
2025-01-17 17:39:22 +01:00
..
src
Cargo.toml chore: Use workspace fields for edition and publish (#23291) 2025-01-17 17:39:22 +01:00
extension.toml
LICENSE-APACHE
README.md Move git status out of Entry (#22224) 2025-01-04 01:00:16 +00:00

Zed Perplexity Extension

This example extension adds the /perplexity slash command to the Zed AI assistant.

Usage

Open the AI Assistant panel (cmd-r or ctrl-r) and enter:

/perplexity What's the weather in Boulder, CO tomorrow evening?

Development Setup

  1. Install the Rust toolchain and clone the zed repo:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
    mkdir -p ~/code
    cd ~/code
    git clone https://github.com/zed-industries/zed
    
  2. Open Zed

  3. Open Zed Extensions (cmd-shift-x / ctrl-shift-x)

  4. Click "Install Dev Extension"

  5. Navigate to the "extensions/perplexity" folder inside the zed git repo.

  6. Ensure your PERPLEXITY_API_KEY environment variable is set (instructions below)

    env | grep PERPLEXITY_API_KEY
    
  7. Quit and relaunch Zed

PERPLEXITY_API_KEY

This extension requires a Perplexity API key to be available via the PERPLEXITY_API_KEY environment variable.

To obtain a Perplexity.ai API token, login to your Perplexity.ai account and go Settings->API and under "API Keys" click "Generate". This will require you to have Perplexity Pro or to buy API credits. By default the extension uses llama-3.1-sonar-small-128k-online, currently cheapest model available which is roughly half a penny per request + a penny per 50,000 tokens. So most requests will cost less than $0.01 USD.

Take your API key and add it to your environment by adding export PERPLEXITY_API_KEY="pplx-0123456789abcdef..." to your ~/.zshrc or ~/.bashrc. Reload close and reopen your terminal session. Check with env |grep PERPLEXITY_API_KEY.