Skip to content

ravisastryk/perplexity-autocomplete

Repository files navigation

Perplexity AutoComplete — Chrome Extension

Perplexity AutoComplete

AI-powered query autocomplete suggestions for Perplexity.ai, built using the Perplexity Sonar API.


What It Does

As you type in Perplexity's search bar, this extension shows 5 AI-generated query suggestions in a native-looking dropdown — similar to Google's autocomplete, but powered by Perplexity's own model.

  • 350ms debounce — suggestions appear without lag
  • Keyboard navigation ( to navigate, Enter to select, Esc to dismiss)
  • Styled to match Perplexity's dark UI
  • Your API key is stored locally — never sent anywhere except the Perplexity API

Demo

Watch the demo

Prerequisites

  • Google Chrome (or any Chromium-based browser: Brave, Arc, Edge)
  • A Perplexity API key (free tier available)

Installation (Step-by-Step)

Step 1 — Download the Extension

Clone or download this repository:

git clone https://github.com/ravisastryk/perplexity-autocomplete.git

Or click Code → Download ZIP on GitHub and extract the folder.


Step 2 — Load Into Chrome

  1. Open Chrome and go to: chrome://extensions
  2. Toggle Developer mode ON (top-right corner)
  3. Click "Load unpacked"
  4. Select the perplexity-autocomplete folder

The extension icon will appear in your Chrome toolbar.


Step 3 — Add Your API Key

  1. Click the extension icon in the toolbar
  2. Paste your Perplexity API key (starts with pplx-)
  3. Click Save API Key

Get your API key: Go to perplexity.ai/settings/api → Create a key


Step 4 — Use It

  1. Open perplexity.ai
  2. Start typing in the search bar (at least 3 characters)
  3. Suggestions appear after ~350ms

Project Structure

perplexity-autocomplete/
├── manifest.json     # Chrome extension config (Manifest V3)
├── background.js     # Service worker — calls Perplexity Sonar API
├── content.js        # Injected into perplexity.ai — renders dropdown
├── styles.css        # Dropdown UI styles
├── popup.html        # Extension popup UI (API key input)
├── popup.js          # Popup logic
└── README.md         # You are here

How It Works

User types in search bar
        ↓
content.js detects input (debounced 350ms)
        ↓
Sends message to background.js
        ↓
background.js calls Perplexity Sonar API
  → prompt: "return 5 autocomplete suggestions as JSON array"
        ↓
Suggestions returned and rendered in dropdown
        ↓
User clicks or presses Enter → query is applied

API Cost Estimate

This extension uses the sonar model (Perplexity's most affordable).

Usage Estimated Cost
100 searches/day ~$0.01–0.05/day
1,000 searches/day ~$0.10–0.50/day

Costs are minimal due to the 350ms debounce (prevents excessive calls while typing).


Customization

Change the model

In background.js, find this line:

model: "sonar",

And change to sonar-pro for higher quality suggestions (slightly higher cost).

Change debounce delay

In content.js, find:

}, 350); // Debounce delay in ms

Increase for fewer API calls, decrease for faster suggestions.

Change number of suggestions

In background.js, update the system prompt:

return exactly 5 complete ...

Change 5 to any number between 3–8.


License

MIT — free to use, modify, and distribute.


Troubleshooting

Issue Fix
No suggestions appearing Check API key is saved and starts with pplx-
"API request failed" Verify your API key has credits at perplexity.ai/settings/api
Dropdown not showing Reload the Perplexity tab after installing extension
Extension not loading Make sure Developer Mode is ON in chrome://extensions

About

A Chrome extension that adds AI-powered query autocomplete to Perplexity.ai using the Sonar API

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors