Khoj web search
The variables that point it at SpecStream.
Khoj searches the web through 5 providers in a fixed order, and its docker-compose.yml runs a SearXNG container for the default. SpecStream answers three of them, SearXNG, Exa and Firecrawl, so Khoj searches with no container and no Serper plan.
Set KHOJ_SEARXNG_URL=https://api.specstream.ai/searxng/YOUR_KEY on the Khoj server and restart. For search and page reading on one key, set EXA_API_URL=https://api.specstream.ai/exa with the key in EXA_API_KEY.
SpecStream scores 97.9 F-score on all 1,000 SimpleQA Verified questions. A search of up to 10 results costs $0.005, with no daily limit. A new account gets $10 of credit, no card, which covers 2,000 searches.
New accounts get $10 of credit, no card. It covers 2,000 searches.
The web search providers Khoj offers, from each company's own pages on Nov 10, 2026
| SpecStream | Serper | Exa | Firecrawl | SearXNG, self-hosted | |
|---|---|---|---|---|---|
| Role in Khoj | Search through KHOJ_SEARXNG_URL, EXA_API_URL or FIRECRAWL_API_URL, and page reading through the Exa or Firecrawl web scraper, on one key | Search only. Tried first when SERPER_DEV_API_KEY is set | Search and web scraper | Search and web scraper | Search only. Tried last, and the default in Khoj's docker-compose.yml |
| Price of a search | $5 per 1,000 searches, with up to 10 results a search | $1.00 per 1,000 in the pack of 50,000 credits | $7 per 1,000 requests on auto, $4 per 1,000 on lite | 2 credits per 10 results | No fee. You run the server, and the engines it queries may enforce CAPTCHAs or ban its IP address |
| Price of reading pages | $0.80 per 1,000 pages through /exa/contents or /firecrawl/v2/scrape, and a page with no text is not charged | Not a web scraper in Khoj | $1 per 1,000 pages per content type | The free plan reads 1,000 pages a month. The Hobby plan is $19 a month | Not a web scraper in Khoj |
| How you start | $10 of credit, no card. It covers 2,000 searches | 2,500 free queries, no credit card | $10 in credits on sign up, no payment method required | A free plan of 500 searches or 1,000 pages | A working Docker or Podman installation |
| How long credit lasts | Credit you buy never expires | Credits are valid for 6 months | The free balance resets to $10 on the first of every month | Monthly plans, from $19 a month for Hobby | No credit to buy |
| Address setting in Khoj | KHOJ_SEARXNG_URL, EXA_API_URL, FIRECRAWL_API_URL, and the WebScraper api_url in Django admin | None. Khoj's code fixes SERPER_DEV_URL at https://google.serper.dev/search | EXA_API_URL, default https://api.exa.ai | FIRECRAWL_API_URL, default https://api.firecrawl.dev | KHOJ_SEARXNG_URL, http://search:8080 in docker-compose.yml |
Why Khoj admins point its search variables at SpecStream
The environment before and after
Khoj reads KHOJ_SEARXNG_URL from the server's environment and asks SearXNG for its HTML results page. SpecStream answers format=html with SearXNG's own markup at https://api.specstream.ai/searxng/<key>, with the key as a part of the address, so Khoj's parser reads it as it is.
# docker-compose.yml, server environment, before
- KHOJ_SEARXNG_URL=http://search:8080
# after: no search container
- KHOJ_SEARXNG_URL=https://api.specstream.ai/searxng/YOUR_SPECSTREAM_KEYKhoj tries Serper, Exa, Firecrawl and Google before SearXNG, so leave their keys unset. The search service can go from docker-compose.yml once search answers.
curl "https://api.specstream.ai/searxng/$SPECSTREAM_API_KEY/search?q=latest+Khoj+release&format=html"Search and read pages with the Exa variables
Set EXA_API_URL and EXA_API_KEY and Khoj sends its searches to /search on that address with the key in x-api-key. With no WebScraper row in Django admin, the same two variables set Khoj's Exa web scraper, which reads pages at /contents. Both run on SpecStream. The Exa migration guide and the Exa contents guide list every field.
# before
- EXA_API_KEY=your_exa_api_key
# after
- EXA_API_KEY=YOUR_SPECSTREAM_KEY
- EXA_API_URL=https://api.specstream.ai/exacurl -X POST https://api.specstream.ai/exa/search \
-H "x-api-key: $SPECSTREAM_API_KEY" -H "Content-Type: application/json" \
-d '{"query": "latest Khoj release", "numResults": 10}'A WebScraper row in Django admin
When the admin panel already has WebScraper rows, Khoj uses them and not the variables. EXA_API_URL only fills in a new row. Open the Exa row, set api_url to https://api.specstream.ai/exa and the API key to your SpecStream key, and save.
Already on Firecrawl? Change one URL
Set FIRECRAWL_API_URL to https://api.specstream.ai/firecrawl, with no version: Khoj adds /v2/search for a search and /v2/scrape for a page, and sends the key as a Bearer token. The Firecrawl migration guide lists every field.
# before
- FIRECRAWL_API_KEY=fc-...
# after
- FIRECRAWL_API_KEY=YOUR_SPECSTREAM_KEY
- FIRECRAWL_API_URL=https://api.specstream.ai/firecrawlWhat stays the same
Khoj's own search and scraper code reads each reply, unchanged. The SearXNG route returns SearXNG's results page, 10 results a search. The Exa route returns results[] with url, title, publishedDate and text, and the Firecrawl route data.web[]. Every parameter is in the SearXNG migration guide.
$0.005 a search and $0.0008 a page
A search of up to 10 results costs $0.005, which is $5 per 1,000, with no daily limit. Each page read through the Firecrawl scrape or Exa contents route costs $0.0008, which is $0.80 per 1,000 pages, and a page with no text costs nothing.
There is no monthly plan, no credit pack that expires and no reset on the first of the month. Credit you buy never expires.
The most accurate web search API in the world
On SimpleQA Verified the SpecStream Search API scores 97.9 F-score on all 1,000 official questions, 978 of them correct. On WideSearch it scores 64.0 item F1 and 43.4 row F1 on all 200 official tasks. The Extract API scores 0.908 F1 on WCXB. Every score and its method is on the benchmarks page.
About one second a search, measured under load
Every drop-in route runs on the fast search. On November 9, 2026 production took 1, 5, 10 and 20 searches a second through it and answered 718 of 720. The median was 0.82 s at 1 search a second and 1.07 s at 20 a second, and the 95th percentile stayed between 1.09 and 1.73 s. One account can send up to 26,666 searches a minute; a call over that gets a 429 with Retry-After and is not charged.
You decide what is kept, on each key
Give Khoj a key with zero_retention and a search made with it keeps no request text and no answer after the reply. It is not in the history and its log lines carry neither. The charge keeps the account, the key, the request ID, the price and the time. spend_cap_cents is the most the key can spend.
curl -X POST https://api.specstream.ai/v1/account/keys \
-H "Authorization: Bearer $SPECSTREAM_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "production", "scopes": ["account:read", "finds:spend"], "spend_cap_cents": 500000, "zero_retention": true}'Search, pages and rows on one key
The same key reads up to 20 pages or documents a call with the Extract API at $0.80 per 1,000 pages, and a page with no text is not charged. Deep Search takes a request in plain words and returns every match on the live web as structured rows, at 5¢, 15¢ or $1 a row, with a source URL on every value.
The other providers in Khoj, and what each costs
Serper
Search sold in credit packs: $1.00 per 1,000 in the pack of 50,000, with credits valid for 6 months and 2,500 free queries to start. Khoj fixes Serper's address in its code and tries it first. SpecStream searches the live web at $5 per 1,000 on credit that never expires, and reads the pages too.
Exa
Search at $7 per 1,000 requests on auto and $4 on lite, and page contents at $1 per 1,000 pages per content type. Set EXA_API_URL to https://api.specstream.ai/exa and the same calls cost $0.005 a search and $0.0008 a page.
Firecrawl
Search at 2 credits per 10 results, on a free plan of 500 searches or 1,000 pages and paid plans from $19 a month for Hobby. Set FIRECRAWL_API_URL to https://api.specstream.ai/firecrawl and search and page reads run on SpecStream, on one key.
SearXNG, self-hosted
The search container in Khoj's docker-compose.yml. An engine that answers too many requests is suspended for 3,600 seconds, and one that shows a CAPTCHA for 86,400. SpecStream answers the same HTML call at $0.005 a search, with no container to run.
Google Custom Search
Khoj fixes Google's address at https://www.googleapis.com/customsearch/v1, and Google gives existing Custom Search JSON API customers until January 1, 2027 to move. SpecStream answers through KHOJ_SEARXNG_URL or EXA_API_URL today, with 97.9 F-score on all 1,000 SimpleQA Verified questions.
How SpecStream scores
The same numbers as the benchmarks page, from the official tasks and scorers.
How to set SpecStream as Khoj's web search
1. Create a key under Agents & API in the SpecStream workspace. A new account gets $10 of credit, no card, which covers 2,000 searches.
2. In the Khoj server's environment, remove SERPER_DEV_API_KEY and the Google keys if they are set, and set the Exa variables.
EXA_API_KEY=YOUR_SPECSTREAM_KEY
EXA_API_URL=https://api.specstream.ai/exa3. Or, to keep the SearXNG path, set the SearXNG variable alone.
KHOJ_SEARXNG_URL=https://api.specstream.ai/searxng/YOUR_SPECSTREAM_KEY4. If Django admin has WebScraper rows, set the Exa row's api_url to https://api.specstream.ai/exa with your SpecStream key.
5. Restart Khoj and send a chat with the /online prefix. Each search and each page shows up in your SpecStream request log with its price.
Frequently asked questions
Something we didn't answer? Talk to a human
How do I set up web search in self-hosted Khoj?
KHOJ_SEARXNG_URL=https://api.specstream.ai/searxng/YOUR_KEY, or EXA_API_URL=https://api.specstream.ai/exa with the key in EXA_API_KEY. A search costs $0.005, with no container to run.How do I point Khoj at a different SearXNG?
KHOJ_SEARXNG_URL, which is http://search:8080 in Khoj's docker-compose.yml. Set it to https://api.specstream.ai/searxng/ followed by your key, and SpecStream answers the HTML results page Khoj reads.Why is Khoj online search not working?
KHOJ_SEARXNG_URL at SpecStream and restart; a wrong key gets a 401.Which search API does Khoj use first?
Can Khoj read web pages through SpecStream?
https://api.specstream.ai/exa and https://api.specstream.ai/firecrawl, on the same key as search.Is there a free search API for Khoj?
Which web search API is best for Khoj?
Sources
SpecStream wrote this page. Khoj's settings come from its source on GitHub and its docs, and each provider's figure from that company's own page.
- Khoj online_search.pygithub.com/khoj-ai/khoj/blob/master/src/khoj/processor/tools/online_search.py, read Nov 10, 2026
- Khoj database adaptersgithub.com/khoj-ai/khoj/blob/master/src/khoj/database/adapters/__init__.py, read Nov 10, 2026
- Khoj docker-compose.ymlgithub.com/khoj-ai/khoj/blob/master/docker-compose.yml, read Nov 10, 2026
- Khoj online search docsdocs.khoj.dev/features/online_search/, read Nov 10, 2026
- Serperserper.dev/, read Nov 10, 2026
- Exa pricingexa.ai/docs/admin/pricing.md, read Nov 10, 2026
- Firecrawl pricingfirecrawl.dev/pricing, read Nov 10, 2026
- SearXNG own instancedocs.searxng.org/own-instance.html, read Nov 10, 2026
- SearXNG search settingsdocs.searxng.org/admin/settings/settings_search.html, read Nov 10, 2026
- SearXNG Docker installationdocs.searxng.org/admin/installation-docker.html, read Nov 10, 2026
- Google Custom Search JSON APIdevelopers.google.com/custom-search/v1/overview, read Nov 10, 2026
- SpecStream benchmarksspecstream.ai/benchmarks, read Nov 10, 2026
- SpecStream pricingspecstream.ai/pricing, read Nov 10, 2026
- SpecStream for agentsspecstream.ai/agents.md, read Nov 10, 2026




