In August last year, I wrote 150 lines of AI Web Search Agent. One Hono endpoint, Google's GenAI SDK, and a Firecrawl API key doing the actual searching. It worked on the first try, and I was very pleased with myself for about a week.
Then I wanted to give that agent to other people. That is where it fell apart. The search part was someone else's API, billed in dollars, free only up to a limit. Every new user meant a new line on somebody's invoice. I wrote about that frustration in Crawling and Searching, and then I did the stubborn thing: I built my own search endpoints inside my Hono API.
So this post is two things. First, an honest guide to the best web search API for AI agents and LLM apps right now: what each one costs per 1,000 searches, what the free tier really gives you, and where each one breaks. Second, the free and open-source side that the top-10 lists skip, including the Hono.js search code I run myself.
Prices and free tiers below were checked in the first week of December. This market changes every month, so treat any number as "check before you build".
The quick answer
If you only read one table, read this one.
| If you need... | Pick | Why |
|---|---|---|
| A safe default for a chatbot or support agent | Brave Search API | Own independent index, fast, $5 per 1,000 requests |
| Search plus the full page in one call | Firecrawl or Tavily | Fewer tool calls, less glue code |
| Meaning-based discovery ("companies like X") | Exa | Neural search and Find Similar |
| The cheapest high-volume grounding | Parallel (Turbo) or Serper | Around $1 per 1,000 |
| Raw Google results (People Also Ask, Maps, Shopping) | Serper or SerpApi | Real SERP data as JSON |
| EU data rules and zero data retention | Linkup | SOC 2 Type II, GDPR focus |
| A huge fresh index with highlights included | Yep by Ahrefs | 100B+ pages, 1,000 free requests |
| Zero dollars, full control | SearXNG or DDGS | Open source, self-hosted |
| Your own endpoint, your own rules | The Hono search API below | Puppeteer + DuckDuckGo fallback |
What is a web search API, really?
A web search API lets your code (or your agent) send a query and get back ranked results as JSON instead of an HTML page. For an LLM, it is the difference between "answer from what you saw during training" and "answer from what the web says today". People call this grounding, and it is the cheapest way to cut down on made-up facts in RAG apps.
It does not remove hallucinations, though. A model can still pick a source and then bend it to fit an answer it already wanted to give. A Confident AI write-up on grounding cites research where a large share of checked citations showed exactly that. Search helps. You still have to evaluate the answers.
Two old defaults are gone, which is why so many people are shopping for a web search API right now:
- The Bing Search API was retired in August 2025. Microsoft points people to "Grounding with Bing" inside its own agent platform instead.
- Google's Custom Search JSON API is closed to new customers, and existing users have been told to move off it by January 1, 2027.
The four types of search API for AI agents
Every product in this post falls into one of four buckets. Knowing the bucket tells you most of what you need.
- SERP APIs (Serper, SerpApi, Bright Data SERP). They fetch a real search engine's results page and hand you titles, URLs and snippets as JSON. Great for Google-specific data. You still need a second step to read the pages.
- AI-native search APIs (Brave, Exa, Tavily, Parallel, Linkup, You.com, Yep). Built for LLMs. They return clean excerpts sized for a context window, often from their own index.
- Search plus extraction (Firecrawl, Jina Reader search). Search, then scrape the top results into Markdown in the same request.
- Model-native search (OpenAI, Anthropic and Gemini built-in tools). One flag on your model call. Easy, but you cannot swap the retrieval layer, and one prompt can trigger several billed searches.
How I judged them
I care about different things than an enterprise buyer, so here is my list, in order:
- Cost per grounded answer, not per call. If the API only gives snippets and you need a second scrape call, your real price doubles. Agents also fan out: one question can become five searches.
- Does the page content come back in the same call? Fewer round trips means faster agent loops.
- Latency inside a loop. 1 second feels fine once. Ten sequential tool calls at 1 second each is a bad chat experience.
- Index independence. Some APIs run their own index (Brave, Yep, You.com). Others wrap Google or Bing results. Wrapped results can break when the upstream changes.
- A free tier you can actually build on. Does it need a card? Does it refill every month or only once?
- MCP and SDK support, so I can plug it into Claude, Cursor or a LangChain agent in five minutes.
For speed and quality I lean on third-party numbers where they exist, mainly the AIMultiple agentic search benchmark as reported by Growthner. Vendor benchmarks (Parallel, Linkup, NewsCatcher, Nimble all rank themselves first on their own blogs) I treat as marketing until I run my own 50 queries.
The 14 best web search APIs for LLMs and AI agents
1. Brave Search API: the default I would start with
Brave Search API runs on Brave's own index, not Google's or Bing's. In the AIMultiple run it had the best agent score and was also the fastest of the group, at roughly two-thirds of a second per call.
- Price: $5 per 1,000 requests. The LLM Context endpoint returns ranked text chunks ready for a prompt.
- Free tier: Brave removed its free plan in February 2026. You now get $5 of monthly credit (about 1,000 searches), a card is required, and the credit depends on showing Brave attribution on your site.
- Best for: live chatbots, support agents, any RAG app that wants a non-Google source.
- The catch: no scraping, no crawling, no document parsing. And no default spending cap, so set alerts.
2. Exa: search by meaning
Exa uses embeddings, so you can search for "early-stage startups building dev tools for Rust" and get pages that match the idea, not the keywords. Find Similar takes a URL and returns lookalikes, which is brilliant for lead lists.
- Price: about $7 per 1,000 searches with contents for up to 10 results; Deep Search from $12 per 1,000; a Lite tier at $4.
- Free tier: a monthly free credit for new accounts (check the current amount).
- Best for: research agents, lead discovery, "hidden gem" links.
- The catch: rankings can feel odd for precise factual lookups like "today's USD to INR rate".
3. Tavily: the LangChain favourite
Tavily is the one every agent tutorial uses, because it plugs straight into LangChain and LlamaIndex and returns answer-focused results with relevance scores.
- Price: $0.008 per credit pay-as-you-go. A basic search costs 1 credit, an advanced one costs 2.
- Free tier: 1,000 credits a month, no card.
- Best for: prototypes, RAG pipelines, teams already on LangChain.
- The catch: advanced depth doubles your bill fast, and raw mode can hand you HTML you have to clean up yourself.
4. Parallel: cheap and fast if you pick the right mode
Parallel has four search modes. Turbo and Fast cost $1 per 1,000 and Turbo answers in about 200 ms. Basic and Advanced cost $5 per 1,000 and dig deeper. There is also a Task API for long multi-step research.
- Free tier: $5 of monthly credit.
- Best for: high-volume grounding, voice agents where latency hurts, background research jobs.
- The catch: most of its impressive benchmark numbers come from its own harness. Run your own test.
5. Firecrawl: search that keeps reading
Firecrawl is what my first agent used. One search call returns results and can scrape each one into clean Markdown. It also crawls, maps sites, parses PDFs and has an open-source core.
- Price: 2 credits per 10 search results, about 1 credit per scraped page; Hobby plan $19 a month.
- Free tier: 1,000 credits a month.
- Best for: agents that need the whole page, docs and PDFs, not just a snippet.
- The catch: subscription credits, no pure pay-as-you-go, and full-page work is slower.
6. Linkup: the compliance pick
Linkup offers Fast, Standard and Deep search, plus fetch and research endpoints. It is SOC 2 Type II, offers zero data retention, and leans into UK and EU customers.
- Price: around $5 per 1,000 standard searches.
- Free tier: trial credits.
- Best for: European products, anything with a strict DPA.
- The catch: independent speed numbers are thin, so test latency yourself.
7. You.com Web Search API
You.com runs its own index and can return up to 100 results per call, with snippets or full pages.
- Price: $5 per 1,000 calls, plus $1 per 1,000 pages if you want full content.
- Free tier: a free daily allowance through its MCP server.
- Best for: general-purpose agents and coding assistants.
- The catch: full-page extraction costs extra.
8. Perplexity Search API
The Perplexity API gives you raw search results (1 to 20 per call) or Sonar, which returns a finished answer with citations.
- Price: $5 per 1,000 searches; Sonar adds token costs.
- Best for: async summaries and cited answers where nobody is waiting.
- The catch: it was the slowest in the AIMultiple run, more than 11 seconds per call. Not for a live chat.
9. Serper: the cheapest Google results
Serper returns Google results as JSON: organic links, People Also Ask, related searches, plus Images, News, Maps, Shopping, Scholar and Patents.
- Price: $1 per 1,000 on the $50 pack, down to $0.30 per 1,000 on the largest pack. Credits last 6 months.
- Free tier: 2,500 searches once, no card.
- Best for: SEO tools, rank checks, agents that need Google specifically.
- The catch: snippets only. You need a fetch step to read pages.
10. SerpApi: every engine, every SERP feature
SerpApi covers Google, Bing, DuckDuckGo, Baidu, Yandex, YouTube, Amazon and dozens more, with up to 14 fields per result and AI Overview data.
- Price: $25 a month for 1,000 searches, getting cheaper at volume.
- Free tier: 250 searches a month.
- Best for: multi-engine data, local and shopping results.
- The catch: responses are heavy. In OpenWeb Ninja's test the median response was around 67 KB, roughly twenty times bigger than Serper's. That is a lot of tokens if you paste it into a prompt.
11. Jina Reader search (s.jina.ai)
Put https://s.jina.ai/?q= before a query and Jina Reader searches the web and returns the top five results with their pages already converted to clean text. Jina is now part of Elastic, and the API keeps running as before.
- Price: token-based; each search costs a fixed amount starting at 10,000 tokens.
- Free tier: free tokens on every new key (non-commercial terms).
- Best for: quick prototypes where you want search plus content in one GET.
- The catch: only five results, and the token meter drains fast on search.
12. Yep by Ahrefs: the new big index
Yep is a web search API built on the crawl that powers Ahrefs' SEO tools: over 100 billion pages, around 8 billion re-crawled every day, filters for language, country, domain and crawl date, and query highlights included in every response.
- Price: from $4 per 1,000 requests with up to 20 results, typically $7 to $8 for AI-optimised tiers.
- Free tier: 1,000 requests, no card.
- Best for: freshness-sensitive agents, SEO and AEO tooling.
- The catch: it is new as an API, so there is little independent benchmark data yet.
13. Cloudflare Web Search API
Cloudflare's Web Search API launched in open beta in October. It sits inside AI Gateway, so you get one interface, unified logs and billing, and you choose the provider per request: Ceramic.ai (the default), Exa or Linkup, at their list price with no markup. Prices land between about $0.25 and $7 per 1,000 depending on the provider. You can also bring your own provider key.
- Best for: anyone already on Workers, or teams that want to switch providers with a one-word change.
- The catch: it is a beta, and no free allowance has been confirmed.
14. Model-native search (OpenAI, Anthropic, Gemini)
Turning on the built-in web search tool is the easiest path. OpenAI and Anthropic charge about $10 per 1,000 searches plus tokens. Gemini's Google grounding includes 5,000 grounded prompts a month on paid plans, then $14 per 1,000.
- Best for: a quick demo, or an app locked to one model provider.
- The catch: you cannot swap the retrieval layer, you cannot see much of what it searched, and one user question can trigger several billed searches.
Also worth a look: Bright Data SERP API ($1.50 per 1,000 successful requests, 5,000 free a month), TinyFish (search and fetch free within published limits), Octen (claims very low latency at high concurrency), NewsCatcher (event and news monitoring), DataForSEO (bulk SEO data).
The comparison table
| API | Type | Price per 1,000 | Free tier | Full page in same call | Own index | Best for |
|---|---|---|---|---|---|---|
| Brave | AI-native | $5 | $5 monthly credit, card | No (LLM Context chunks) | Yes | Chatbots, RAG |
| Exa | AI-native | $4 to $12 | Monthly credit | Yes | Yes | Discovery, leads |
| Tavily | AI-native | $8 (PAYG) | 1,000 credits/mo | Optional | Undisclosed | LangChain agents |
| Parallel | AI-native | $1 to $5 | $5 monthly credit | Excerpts | Not stated | Volume, low latency |
| Firecrawl | Search + extract | ~$6.40 on entry plan | 1,000 credits/mo | Yes | No | Full pages, PDFs |
| Linkup | AI-native | ~$5 | Trial credits | Optional | Yes | EU, compliance |
| You.com | AI-native | $5 (+$1/1K pages) | Daily MCP allowance | Optional | Yes | General agents |
| Perplexity | AI-native | $5 | Pay as you go | No | Not stated | Async cited answers |
| Serper | SERP | $0.30 to $1 | 2,500 once | No | No (Google) | Google data |
| SerpApi | SERP | ~$5.50 to $25 | 250/mo | No | No | Multi-engine SERP |
| Jina s.jina.ai | Search + extract | Token-based | Free tokens | Yes (top 5) | No | Fast prototypes |
| Yep (Ahrefs) | AI-native | $4 to $8 | 1,000 once | Highlights | Yes | Fresh, large index |
| Cloudflare | Gateway | $0.25 to $7 | Not confirmed | Depends on provider | Via provider | Workers users |
| Model-native | Built-in tool | $10 to $14 + tokens | Gemini quota | Answer only | Provider's | Demos |
The one I run myself: a Hono.js web search API with a DuckDuckGo fallback
Here is the opinion part. For most of what I build (lead-finding agents, content research for iHateReading, the AI scraping agent dashboard), I do not need the best search quality on earth. I need search that is good enough, costs me nothing per call, and that I can change when a page layout changes.
So the search endpoints live inside my open-source Hono API: github.com/shreyvijayvargiya/ihatereading-api. It is the same Hono plus OpenRouter pattern I used for the GitHub repository explainer agent.
It has three search routes:
| Route | What it does |
|---|---|
POST /google-search | Opens Google in headless Chrome, parses results, falls back to DuckDuckGo if blocked |
POST /bing-search | Same idea for Bing, through a rotating proxy |
POST /ddg-search | DuckDuckGo's HTML results page, parsed with Cheerio |
Every route returns the same shape: { query, results: [{ title, link, description }], markdown, timestamp }. That shared shape is the whole trick. My agent does not care which engine answered.
How /google-search works, step by step
1. Launch a light browser. It uses puppeteer-core with @sparticuz/chromium, which is small enough for serverless boxes. If that fails locally, it falls back to the Chrome installed on my Mac. Proxies are off by default and turned on with useProxy: true.
2. Build the URL with the right knobs. hl for language, gl for country, num for result count, and pws=0 to switch off personalised results:
function buildGoogleSearchUrl({ query, language, country, num, gbv = false }) { const params = new URLSearchParams({ q: query, hl: language, gl: country, num: String(num), pws: "0", }); if (gbv) params.set("gbv", "1"); // basic HTML version of Google return `https://www.google.com/search?${params.toString()}`; } 3. Click past the consent screen. European IPs often get a "Before you continue" page. A small helper tries a few known "Accept all" selectors before reading the page.
4. Retry with basic HTML. If parsing finds zero results, it reloads the same query with gbv=1, Google's basic HTML mode, which is far easier to parse.
5. Detect when Google says no. It checks the HTML for the "unusual traffic" message (a CAPTCHA) or a consent interstitial:
function detectGoogleSerpBlocked(html) { const h = (html || "").toLowerCase(); if (h.includes("unusual traffic from your computer network")) return "captcha"; if (h.includes("before you continue")) return "consent_or_interstitial"; return null; } 6. Fall back to DuckDuckGo with a plain fetch. This is the part I like most. No browser at all, just a GET to DuckDuckGo's HTML endpoint and Cheerio:
async function fetchWebResultsViaDuckDuckGo(query, maxResults = 10) { const endpoints = [ `https://html.duckduckgo.com/html/?q=${encodeURIComponent(query)}`, `https://duckduckgo.com/html/?q=${encodeURIComponent(query)}`, ]; for (const searchUrl of endpoints) { try { const res = await fetch(searchUrl, { headers, redirect: "follow" }); if (!res.ok) continue; const results = parseDuckDuckGoSerpHtml(await res.text(), maxResults); if (results.length > 0) { return { results, searchUrl, markdown: webSearchResultsToMarkdown(results) }; } } catch { continue; } } return { results: [], searchUrl: null, markdown: "" }; } DuckDuckGo wraps every link in a redirect, so the parser pulls the real URL out of the uddg parameter before returning it.
7. Return Markdown too. The page is also turned into Markdown, so an LLM can read the whole results page if the snippets are not enough. The response says which source answered (puppeteer-direct, puppeteer-proxy or duckduckgo-html-fallback), which makes debugging easy.
Turning it into an agent
The original 150-line agent used Gemini function calling with Firecrawl. Today I route models through OpenRouter, so here is the same loop pointed at my own search endpoint. Any tool-calling model on OpenRouter works:
import { Hono } from "hono"; import { serve } from "@hono/node-server"; const app = new Hono(); const SEARCH_URL = process.env.SEARCH_API_URL; // e.g. http://localhost:3000/google-search const MODEL = process.env.OPENROUTER_MODEL; // any model that supports tool calling const tools = [{ type: "function", function: { name: "web_search", description: "Search the live web for recent or uncertain facts.", parameters: { type: "object", properties: { query: { type: "string" } }, required: ["query"], }, }, }]; async function webSearch(query) { const res = await fetch(SEARCH_URL, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ query, num: 8 }), }); const data = await res.json(); return (data.results ?? []) .slice(0, 8) .map((r, i) => `[${i + 1}] ${r.title}\n${r.link}\n${r.description}`) .join("\n\n"); } async function chat(messages) { const res = await fetch("https://openrouter.ai/api/v1/chat/completions", { method: "POST", headers: { Authorization: `Bearer ${process.env.OPENROUTER_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ model: MODEL, messages, tools }), }); const data = await res.json(); return data.choices[0].message; } app.post("/agent", async (c) => { const { prompt } = await c.req.json(); const messages = [ { role: "system", content: "Search before answering anything time-sensitive. Cite sources as [1], [2]." }, { role: "user", content: prompt }, ]; for (let step = 0; step < 4; step++) { const msg = await chat(messages); messages.push(msg); if (!msg.tool_calls?.length) return c.json({ answer: msg.content }); for (const call of msg.tool_calls) { const { query } = JSON.parse(call.function.arguments); messages.push({ role: "tool", tool_call_id: call.id, content: await webSearch(query) }); } } return c.json({ answer: "Stopped after 4 search rounds." }); }); serve({ fetch: app.fetch, port: 8787 }); Three things in there matter more than the code itself. The step limit stops runaway loops (and runaway bills, if you swap in a paid API). Numbered results make citations cheap. And because the search function is one small function, swapping my endpoint for Brave or Tavily is a five-line change.
Where my approach falls short
I want to be straight about this. Scraping Google from a server gets you CAPTCHAs, and the code itself says so: it cannot solve them, it only falls back. Search engines' terms also do not love automated scraping, so read them before you put this in front of paying customers. For a high-traffic product, I would put a paid API in front and keep this as the free fallback. For internal agents, research scripts and side projects, it has been plenty.
If you want the bigger picture of where an agent like this runs safely, I compared the options in what an AI agent sandbox is and every open-source and paid option.
20 free and open-source web search APIs for AI agents
Every top-10 list repeats the same names. This table is the other half: GitHub projects you can self-host, keyless MCP servers, and hosted APIs with a free tier worth using. I left out Firecrawl, Exa, Tavily, You.com, ScrapingBee, ScrapingDog, Apify and context.dev on purpose.
| # | Name | Type | What "free" means | API key? | Best for | The catch |
|---|---|---|---|---|---|---|
| 1 | SearXNG | Open-source metasearch | Free, self-hosted | No | Unlimited agent search on your own box | Turn on JSON format in settings.yml; AGPL-3.0 licence |
| 2 | mcp-searxng | MCP server | Free | No | Giving Claude or Cursor search via SearXNG | Needs a SearXNG instance you run or trust |
| 3 | DDGS | Python metasearch library | Free (MIT) | No | Python agents; also runs as a REST or MCP server | Upstream engines can rate-limit you |
| 4 | open-webSearch | MCP server, CLI | Free | No | Multi-engine search (Bing, DuckDuckGo, Brave and more) via npx | Depends on public engines that may throttle |
| 5 | Vane (formerly Perplexica) | Open-source AI answer engine | Free (MIT), self-hosted | No | A private Perplexity-style app with an API | You run the app, SearXNG and the model |
| 6 | duckrush | Hono search API | Free, self-hosted | No | LLM-ready search on Cloudflare Workers | Small project; check activity before relying on it |
| 7 | ihatereading-api | Hono search + scrape API | Free, self-hosted | No | Google, Bing, DuckDuckGo endpoints with one shape | CAPTCHAs on Google; proxies cost money |
| 8 | Marginalia Search API | Independent search engine | Free non-commercial key by email; shared public key | Yes (free) | Blogs and small-web results | Small index; public key hits rate limits |
| 9 | MediaWiki API (Wikipedia) | Encyclopedia search | Free | No | Fact grounding, entity lookups | Wikipedia only |
| 10 | Hacker News Search (Algolia) | Niche search API | Free | No | Dev and startup research agents | HN content only |
| 11 | GitHub Search API | Code and repo search | Free | Optional (higher limits with a token) | Coding agents, "find a library for X" | Low rate limit without a token |
| 12 | Jina s.jina.ai | Search + page text | Free tokens per new key | Yes | Search and read in one GET | Non-commercial free tokens; 5 results only |
| 13 | Yep by Ahrefs | Hosted index | 1,000 requests, no card | Yes | Testing a 100B-page index | One-time allowance |
| 14 | Serper | Google SERP | 2,500 searches once, no card | Yes | Google results for an MVP | No monthly refill |
| 15 | SerpApi | Multi-engine SERP | 250 searches a month | Yes | Light multi-engine use | Heavy JSON responses |
| 16 | OpenWeb Ninja Web Search | Google SERP | 100 requests a month, no card | Yes | Fast, compact Google results | Small allowance |
| 17 | Brave Search API | Independent index | $5 monthly credit (~1,000 searches) | Yes, card | Best quality per free search | Card required; attribution needed for the credit |
| 18 | B...Source:https://dev.to/shreyvijayvargiya/best-web-search-api-for-llms-and-ai-agents-14-paid-picks-20-free-options-and-the-hono-agent-i-run-37b6 PreviousLooking to connect & collaborate with Software Developers in Canada or the USNextI turned my old iPhone into a desk pet that babysits my AI agents Related posts![]() Brickyard: Launch Your Own Game Platform, With the Studio Inside the App0dev.to Secure a new Linux VPS in 15 minutes (2027 checklist for Ubuntu 24.04)0dev.to Why Putting an LLM in Your Webhook Hot Path Is a Mistake (And How I Built a Zero-PII Self-Healing Gateway in .NET 9)0dev.to ![]() RAG Vector Database Sizing Guide: HNSW RAM, Quantization & Cost (Qdrant vs pgvector vs Pinecone)0dev.to How I Built and Scaled a Directory to 100+ Indie Makers on a $0/Month Stack0dev.to XXE is a parser setting: how to test it and how to actually fix it0dev.to show = false, 2600)"
x-show="show" x-cloak x-transition.opacity.duration.200ms
class="fixed bottom-8 left-1/2 z-[80] -translate-x-1/2 rounded-lg border border-line bg-card px-4 py-2.5 text-sm text-heading shadow-card-hover"
role="status" aria-live="polite">
|

