Brave Search
Point clients with a configurable Brave Search endpoint at Search1API to keep Brave's web, news and image search formats.
Search1API answers the Brave Search API's web, news and image search endpoints:
| Brave Search | Search1API |
|---|---|
https://api.search.brave.com/res/v1/web/search | https://api.search1api.com/compat/brave/res/v1/web/search |
https://api.search.brave.com/res/v1/news/search | https://api.search1api.com/compat/brave/res/v1/news/search |
https://api.search.brave.com/res/v1/images/search | https://api.search1api.com/compat/brave/res/v1/images/search |
Send your Search1API key in the X-Subscription-Token header, as Brave clients do. Authorization: Bearer also works. Searches use Search1API's default engine.
This works with clients that let you set the endpoint, such as LangChain's BraveSearchWrapper and Dify's Brave tool. Clients that build the Brave URL themselves cannot be pointed here.
Configure your client
from langchain_community.utilities import BraveSearchWrapper
search = BraveSearchWrapper(
api_key="YOUR_API_KEY",
base_url="https://api.search1api.com/compat/brave/res/v1/web/search",
search_kwargs={"count": 5},
)
results = search.run("hono cloudflare workers")curl "https://api.search1api.com/compat/brave/res/v1/web/search?q=hono+workers&count=5" \
-H "X-Subscription-Token: YOUR_API_KEY"Parameters
| Parameter | Behavior |
|---|---|
q | Required. |
count | Web: default and maximum 20. News: default 20, up to 50. Images: default and maximum 50. |
offset | Page index from 0, in units of count, as in Brave. Pages beyond the first 50 results return no results. |
search_lang, ui_lang | Primary language of the results. |
freshness | pd, pw, pm, py, or a YYYY-MM-DDtoYYYY-MM-DD range converted to the shortest of day, week, month or year that covers it. |
country, safesearch, extra_snippets, goggles, result_filter, summary, spellcheck and text_decorations are ignored.
Response
- Web search returns
type: "search",query(originalandmore_results_available),mixedandweb.results. Each result hastype,title,url,description,profile,meta_urland, when known,page_age. - News search returns
type: "news"andresults, with the same result fields andtype: "news_result". - Image search returns
type: "images"andresults, whereurlandthumbnail.srcare the image URL andsourceis its host name.
extra_snippets, age, thumbnail on web results, and the faq, discussions, videos, infobox and summarizer sections are not returned.
Credits
Each request costs 1 credit, the price of a native search.
Errors
Errors return { "type": "ErrorResponse", "error": { "id", "status", "code", "detail", "meta" }, "time" } with the status code. Codes are VALIDATION (400, 422), SUBSCRIPTION_TOKEN_INVALID (401), QUOTA_LIMITED (402), RATE_LIMITED (429) and INTERNAL_ERROR.