Skip to content
Guide

Setting up Brave

Web search for Aldwin from Brave's independent search index.

On this page

Brave Search gives Aldwin results from an independent web index, with a short description for each page. This guide covers what Brave is, how to get a key, and how to connect it to Aldwin.

What Brave is#

Brave runs its own web index rather than reselling another engine's results. Aldwin uses the Brave Search Web API, which returns plain web results. See Brave.

When Aldwin searches with Brave, your query goes to Brave over the internet. If you want search that stays on your own machine, use SearXNG instead.

What you need#

  • A Brave account and API key
  • Aldwin installed (uv tool install aldwin)

The Brave Search API needs a plan on your account. What you get each month depends on the plan you pick. See Brave Search API plans. Aldwin does not count your usage; Brave tells it when you run out.

Get a key#

  1. Sign in at the Brave Search API dashboard.
  2. Subscribe to a search plan.
  3. Open API keys and create a key.
  4. Copy the key. Treat it like a password.

Connect Aldwin#

In the web app#

  1. Open Settings from the bottom of the sidebar and choose Search.
  2. Find Brave and select Connect.
  3. Paste your key and select Connect. Aldwin checks the key with Brave before saving it, and tells you why if it does not work.
  4. If Brave 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#

  1. Start Aldwin and type /search.
  2. Use the arrow keys to pick Brave under Not connected, then press Enter.
  3. Aldwin shows where to get a key. Paste it at Brave API key: (the input is hidden) and press Enter.
  4. Aldwin shows Checking key…. Brave has no free way to check a key, so the check spends one Brave query.
  5. When the key works you see ✓ Brave connected · now used for search. If it doesn't, Aldwin says why and asks again; press Enter on 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 Brave again to Update key or Disconnect.

You can also type /search brave: Aldwin uses Brave 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):

brave_api_key: your-key-here

Environment variable, for one terminal session or in your shell profile (~/.zshrc or ~/.bashrc):

export BRAVE_API_KEY=your-key-here

BRAVE_SEARCH_API_KEY works too. When both are set, BRAVE_API_KEY wins.

An 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. Brave comes after Tavily and SearXNG, so it is picked automatically only when neither of those is set up.

Try it#

aldwin

Ask 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 · Brave (chosen) at the top.

Privacy notes#

  • Your search queries go to Brave, which handles them under its own terms.
  • Pages Aldwin then opens with web_fetch are fetched from your machine, not through Brave.
  • When you connect, Aldwin sends the key to Brave 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 saysFix
Brave rejected this key (HTTP 422). ...The key is wrong, revoked, or was pasted with extra characters. Copy it again from the Brave dashboard.
Brave accepted the key, but the account is out of credits (HTTP 402). ...Add credit or move to a bigger plan, then connect again.
Brave is rate limiting this key (HTTP 429). ...Wait a minute and try again.
Could not reach Brave to check the key ...Check your internet connection. If it keeps happening, Brave may be down; try again later.
Brave's key comes from BRAVE_API_KEY in your environment. ...Disconnect can't remove an environment variable. Delete the export BRAVE_API_KEY=... line from your shell profile, then restart Aldwin.
Brave search isn't set up. ...Aldwin has no key for Brave. Run /search and connect it.
invalid or unauthorized Brave API key (HTTP 401)The key stopped working after it was connected (revoked or expired). Run /search, pick Brave, and choose Update key.
invalid or unauthorized Brave API key (HTTP 422)Brave no longer accepts the key: it was revoked or the plan ended. Check the subscription in the Brave dashboard, then run /search, pick Brave, and choose Update key.
Brave 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 Brave dashboard.
request timed outBrave took longer than 15 seconds to answer a search. Try again, or switch provider with /search.
Aldwin uses another providerRun /search, pick Brave, and choose Use for search. With Automatic, a provider earlier in the order wins.
Was this page helpful?