Web search API for AI agents
Web search and page reading built for LLMs: results with summaries written for models, any page as clean Markdown. Priced per call, over REST or MCP.
An agent that answers from the web needs two calls: one that finds relevant pages, and one that reads the pages worth reading. Web search returns up to 50 results, each with a summary written for a model. Read a web page is a web page to Markdown API: it returns any public page as clean Markdown. Both cost $0.0009 per call and draw on the same prepaid key and balance as your model calls, from a REST request or the MCP server.
Hand it to your AI agent
Copy this prompt into Claude Code, Cursor, Codex or any coding agent. It tells the agent where the docs are and how to use your API key.
Add web search and page reading to this project with the Lovely Router web search API.
- Docs (read first): https://lovelyrouter.com/docs/tools.md and https://lovelyrouter.com/docs/tools/run.md
- Search: POST https://lovelyrouter.com/v1/tools/web-search/run. Read a page as clean text/Markdown: POST https://lovelyrouter.com/v1/tools/web-fetch/run. Get each tool's input fields first with GET https://lovelyrouter.com/v1/tools/web-search and GET https://lovelyrouter.com/v1/tools/web-fetch (public, no key needed).
- Request body: `{"input": {...}}`. A 202 means the run is still going: poll the `poll` path until `status` is final, then read `items`.
- If you support MCP, you can instead connect the server https://lovelyrouter.com/mcp (Streamable HTTP, same key; https://lovelyrouter.com/docs/tools/mcp.md) and use suggest_tools, get_tool and run_tool.
- Auth: read my API key from the LOVELY_API_KEY environment variable and send it as `Authorization: Bearer $LOVELY_API_KEY`. Never print or commit the key. If it is not set, ask me to create one at https://lovelyrouter.com/app/keys.
- Billing is prepaid: every call is charged to my balance, so test with a small request before running anything large.
- Every docs page is plain Markdown; the full index is https://lovelyrouter.com/llms.txt.
My task: <describe what you want to build or get>How it works
Get a key
Search the web
Send the query, and optionally
count(1 to 50 results) ininput. The price is per search, socountdoesn't change it.Shellcurl https://lovelyrouter.com/v1/tools/web-search/run \ -H "Authorization: Bearer $LOVELY_API_KEY" \ -H "content-type: application/json" \ -d '{ "input": {"query": "electric car prices site:reuters.com OR site:bloomberg.com after:2026", "count": 10}, "max_results": 1 }'Read the pages worth reading
Pass one URL to
web-fetchand get its title and text as Markdown, without menus or ads.cURLcurl https://lovelyrouter.com/v1/tools/web-fetch/run \ -H "Authorization: Bearer $LOVELY_API_KEY" \ -H "content-type: application/json" \ -d '{"input": {"url": "https://en.wikipedia.org/wiki/Web_search_engine"}, "max_results": 1}'
Each request waits up to 60 seconds for the run by default (wait goes up to 300). A finished run comes back with 200, its charge_usd and the results in items; a longer one returns 202 and a path to poll. Run a tool covers both.
The search tools
Search the web: up to 50 results with title, URL, date, site, a short snippet and a long summary written for models (and the page text if asked). Operators: site:, -site:, "exact phrase", -word, lang:, after:, before:.
Read any public web page as clean Markdown: its title and text, without navigation or ads. For one page you already have the URL of.
Google results pages for a query: organic results (position, title, URL, snippet, date, sitelinks) and related searches. One result = one results page (~10 links).
News articles from Google News for a search (operators work: "exact phrase", OR, -word, site:, intitle:), optionally within a time window: title, source, date and the article's link on the publisher's site.
returns up to 50 results with title, URL, date, site, a short snippet and a long summary written for models. Set need_content to also get each page's text, and pass the user's original question to rank results better.
is for a page you already have the URL of: the title and text of any public page, as Markdown.
returns Google's own results pages: position, title, URL, snippet, date, sitelinks and related searches, by country and interface language hl, with time filters in tbs. Each results page of about ten links is one billed result.
returns articles with title, source, date and the link on the publisher's site, filtered to a window such as the last 1d or a dateFrom / dateTo range.
returns interest over time and by region for a keyword, or the top trending searches in a country.
Search operators
web-search reads these operators in its query (1 to 128 characters):
| Operator | Example | Effect |
|---|---|---|
site: | site:a.com OR site:b.com | Only these sites |
-site: | -site:example.com | Leave a site out |
"…" | "prompt caching" | Exact phrase |
-word, -"…" | -jobs | Leave out a word or phrase |
lang: | lang:en or lang:zh,en | Results in these languages |
after:, before: | after:2026-01-01, before:2026-06 | Published within a range (years or dates) |
google-news takes "exact phrase", OR, -word, site: and intitle:, and google-search accepts operators as you would type them into Google.
Use it from an agent over MCP
Connect the MCP server and your agent gets web_search and web_fetch as tools, next to the rest of the data tool catalog. The server tells the agent to use them for anything it needs to look up or read, and to keep the browser agent for pages it has to click through. Results come back short and numbered, and web_fetch returns long pages in parts of about 12,000 characters; reading on is free.
claude mcp add --transport http lovely-tools https://lovelyrouter.com/mcp \
--header "Authorization: Bearer $LOVELY_API_KEY"Then ask Claude Code: "Search for this week's announcements about solid-state batteries from news sites, read the three most relevant articles and summarize what changed, with links." MCP server has the setup for Cursor, Claude Desktop and other clients.
Recipes
web-search with after:2026-10-01 and a site: list of trusted sources, then web-fetch the top three results.
Add lang:zh,en to a query to get Chinese and English sources in one search.
Run google-search with your keyword and country: "US", and record each result's position over time.
google-news with the company name in quotes and openEndedDateRange: "1d".
google-trends in keyword mode with predefinedTimeframe: "today 12-m" and a geo country.
What you pay
web-search is billed per search, $0.0009, whether you ask for 1 result or 50; a search with no results costs nothing. web-fetch is billed per page at the same price; a page that can't be read costs nothing. Search Google is billed per results page, Google News per article and Google Trends per call, with live prices on the cards above.
Every run holds its maximum cost from your prepaid balance and settles at what it returned, so you know the most a run can cost before it starts. A run that fails pays only for results it delivered. There is no subscription; see pricing for every tool and model.
Frequently asked questions
How much does a web search cost?+
$0.0009 per search, for any count from 1 to 50 results. A search that finds nothing costs nothing.
What is the difference between web-search and google-search?+
web-search returns results with summaries written for models and supports lang:, after: and before:. google-search returns Google's own results pages with positions, sitelinks and related searches, which suits rank tracking.
Can I get the full text of each page?+
Yes. Set need_content on web-search to include each page's text, or pass a URL to web-fetch to read one page as Markdown.
Does it work with Claude Code and Cursor?+
Yes. Add the MCP server with one command or one config entry, and the agent gets web_search and web_fetch as tools, billed from the same balance.
Can I use it as a search API for RAG?+
Yes. Search for the pages that matter, then set need_content or call web-fetch to get their text as Markdown, and pass that text to the model as context.
Can it read pages behind a login?+
No. web-fetch reads public pages. For pages that need a login, a form or several clicks, use the browser agent.
How many searches can run at once?+
Up to 10 runs can be in progress on an account at once, browser agent runs included. A run over that limit gets 429; start it again when another finishes.
For grounded answers and RAG, see research agents; for turning whole sites into data, see web data extraction.