Setting up Perplexity
Ranked web results with snippets from the Perplexity Search API.
On this page
Aldwin can use the Perplexity Search API for ranked web results with snippets. This guide covers what Perplexity is, how to get a key, and how to connect it to Aldwin.
What Perplexity is#
Perplexity is best known for its answer engine. Aldwin uses only its Search API, which returns a ranked list of pages with snippets, so results look the same as with every other provider and Aldwin's own model does the reading. See Perplexity.
When Aldwin searches with Perplexity, your query goes to Perplexity over the internet. If you want search that stays on your own machine, use SearXNG instead.
What you need#
- A Perplexity account and API key
- Aldwin installed (
uv tool install aldwin)
The Search API is paid per request from your Perplexity API credit balance. See Perplexity API pricing.
Get a key#
- Sign in and open Perplexity API settings.
- Add credit to your API balance if it is empty.
- Generate an API key. It starts with
pplx-. - Copy the key. Treat it like a password.
Connect Aldwin#
In the web app#
- Open Settings from the bottom of the sidebar and choose Search.
- Find Perplexity and select Connect.
- Paste your key and select Connect. Aldwin checks the key with Perplexity before saving it, and tells you why if it does not work.
- If Perplexity is not marked In use, select Use this one.
To remove it later, select Disconnect. You can also switch between connected providers from the search picker in the message box.
In the terminal#
- Start Aldwin and type
/search. - Use the arrow keys to pick Perplexity under Not connected, then press
Enter. - Aldwin shows where to get a key. Paste it at
Perplexity API key:(the input is hidden) and pressEnter. - Aldwin shows
Checking key…. The check is free: Aldwin asks Perplexity about the key without running a search. - When the key works you see
✓ Perplexity connected · now used for search. If it doesn't, Aldwin says why and asks again; pressEnteron an empty prompt to cancel. Nothing is saved until the check passes.
From the same screen you can switch back to another provider, choose Automatic, or pick Perplexity again to Update key or Disconnect.
You can also type /search perplexity: Aldwin uses Perplexity if it is connected, or goes straight to the key prompt if not.
Other ways to add the key#
These skip the check, so use them only if you prefer files or environment variables.
Secrets file. Add this line to ~/.aldwin/secrets.yaml (create the file if it does not exist, and keep any lines already in it):
perplexity_api_key: your-key-hereEnvironment variable, for one terminal session or in your shell profile (~/.zshrc or ~/.bashrc):
export PERPLEXITY_API_KEY=your-key-hereAn environment variable wins over a saved key. With /search set to Automatic, Aldwin uses the first connected provider in this order: Tavily, SearXNG, Brave, Exa, Perplexity, Parallel, Firecrawl. Perplexity comes after Tavily, SearXNG, Brave and Exa, so it is picked automatically only when none of those is set up.
Try it#
aldwinAsk something that needs the live web, for example:
Use web_search to look up today's Python release news.
You should see numbered results with titles, links, and short snippets. Running /search again shows Web search · Perplexity (chosen) at the top.
Privacy notes#
- Your search queries go to Perplexity, which handles them under its own terms.
- Pages Aldwin then opens with
web_fetchare fetched from your machine, not through Perplexity. - When you connect, Aldwin sends the key to Perplexity once to check it. The key is then kept only in
~/.aldwin/secrets.yaml(or your environment), and Aldwin removes it from any error message it shows. - Details: Privacy.
Troubleshooting#
Messages from /search appear right after you paste a key. Errors during a search appear after search failed: in the web_search result.
| What Aldwin says | Fix |
|---|---|
Perplexity rejected this key (HTTP 401). ... | The key is wrong, revoked, or was pasted with extra characters. Copy it again from the Perplexity dashboard. |
Perplexity accepted the key, but the account is out of credits (HTTP 402). ... | Add credit or move to a bigger plan, then connect again. |
Perplexity is rate limiting this key (HTTP 429). ... | Wait a minute and try again. |
Could not reach Perplexity to check the key ... | Check your internet connection. If it keeps happening, Perplexity may be down; try again later. |
Perplexity's key comes from PERPLEXITY_API_KEY in your environment. ... | Disconnect can't remove an environment variable. Delete the export PERPLEXITY_API_KEY=... line from your shell profile, then restart Aldwin. |
Perplexity search isn't set up. ... | Aldwin has no key for Perplexity. Run /search and connect it. |
invalid or unauthorized Perplexity API key (HTTP 401) | The key stopped working after it was connected (revoked or expired). Run /search, pick Perplexity, and choose Update key. |
Perplexity rate limit or quota reached (HTTP 429) | Too many searches at once, or your plan's allowance is used up. Wait a minute, or check usage in the Perplexity dashboard. |
request timed out | Perplexity took longer than 15 seconds to answer a search. Try again, or switch provider with /search. |
| Aldwin uses another provider | Run /search, pick Perplexity, and choose Use for search. With Automatic, a provider earlier in the order wins. |