Skip to the page

Khoj

For self-hosted Khoj: online search runs on the Search API once you set two environment variables on the Khoj server.

Use one of the two pairs below, in the environment Khoj starts in (for Docker, the environment block of the server in docker-compose.yml), then restart Khoj. Khoj uses the first search service it has a key for, in this order: Serper, Exa, Firecrawl. Leave SERPER_DEV_API_KEY unset.

Exa search

Put your key in EXA_API_KEY:

Environment
EXA_API_URL=https://api.specstream.ai/exa
EXA_API_KEY=YOUR_SPECSTREAM_KEY

Firecrawl search

Put your key in FIRECRAWL_API_KEY:

Environment
FIRECRAWL_API_URL=https://api.specstream.ai/firecrawl
FIRECRAWL_API_KEY=YOUR_SPECSTREAM_KEY

Khoj searches with Exa whenever EXA_API_KEY is set, so set only one of the two keys.

Reading web pages

Khoj can also read the pages it finds through the Extract API. In the Khoj admin panel, open Web scrapers and add one: Type Firecrawl, your key in Api key, and this in Api url:

Api url
https://api.specstream.ai/firecrawl

Check it works

In a chat, start your message with /online and ask about something from this week. The answer lists the pages it read as references.

Cost

Each search is one Search API call at $5 per 1,000 searches of up to 10 results. It comes out of your balance, with no quote and no approval. Search API has the details.

Khoj splits one question into a few searches, and each is one Search API call. Each page read by the web scraper is one Extract API page, at $0.80 per 1,000 pages.

Your key

Get your key on the Search API screen of your SpecStream workspace. New accounts start with $10 of credit, no card.

The same setting works in other tools too: Search API by one setting.