anysearch
One interface for every web search API. anysearch is an adapter layer for search
providers — inspired by LiteLLM (one interface for
every LLM) and vector-io (one interface
for every vector DB). Call Octen, Exa, Parallel, Brave, Tavily, Keiro, SerpAPI, Perplexity,
Linkup, Firecrawl, Keenable, and 16 more through a single function, with common parameters and a
common response shape, in Python and JavaScript/TypeScript — plus a stdio MCP
server and optional FastAPI proxy that adapt to whatever API keys you have set.
# Python
import anysearch
resp = anysearch.search("who won the 2026 super bowl?", max_results=5)
// JavaScript / TypeScript
import { search } from "@dhruv-anand-aintech/anysearch";
const resp = await search("who won the 2026 super bowl?", { maxResults: 5 });
If no provider is given, anysearch auto-selects one from the API keys present in your
environment (falling back to keyless DuckDuckGo), so the same code runs anywhere.
Why
Every search API has a different request format, a different auth scheme, and a
different response shape. Swapping providers — or supporting several — means rewriting
glue code each time. anysearch normalizes all of it:
- Lowest-common-denominator params that work everywhere (
query,max_results,country,language, domain filters, date filters,safe_search, web/news). - Unified "extra param modes" for richer features mapped per provider:
mode(fast/balanced/deep),answer(synthesized answers),include_content(full page text),include_summary(AI summaries),highlights(relevant excerpts). - Raw passthrough via
extra/provider_paramsfor anything provider-specific. - One response shape:
title, url, snippet, text, summary, highlights, score, published_date, author, source, raw+ a top-levelanswer.
Providers (27)
See docs/PROVIDERS.md for the full capability matrix.
Install
Install the released packages from PyPI and npm, or install the latest main from GitHub.
Python (pip / uv)
pip install anysearch-sdk
# Latest from main instead:
pip install "git+https://github.com/dhruv-anand-aintech/anysearch.git@main#subdirectory=python"
# Optional: provider native SDKs via extras (for anysearch.native("exa"), etc.)
pip install "anysearch-sdk[exa,parallel]"
pip install "anysearch-sdk[all]"
uv add "anysearch-sdk @ git+https://github.com/dhruv-anand-aintech/anysearch.git@main#subdirectory=python"
uv add "anysearch-sdk[exa,tavily,brave] @ git+https://github.com/dhruv-anand-aintech/anysearch.git@main#subdirectory=python"
uv add "anysearch-sdk[proxy] @ git+https://github.com/dhruv-anand-aintech/anysearch.git@main#subdirectory=python"
The base install works for every provider (REST via httpx). Per-provider extras
add that provider's official SDK for the anysearch.native("<provider>") escape hatch.
JavaScript / TypeScript (GitHub Packages)
npm install @dhruv-anand-aintech/anysearch --registry=https://npm.pkg.github.com
GitHub Packages requires a token even for public packages. Add your GitHub username
and a token with read:packages to ~/.npmrc:
@dhruv-anand-aintech:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
Or install the latest main from GitHub:
npm install github:dhruv-anand-aintech/anysearch#main:js
No runtime dependencies (uses built-in fetch). Provider SDKs are optional and only
needed for native().
Usage
Common parameters
Parameters a provider can't honor are governed by on_unsupported / onUnsupported:
"warn" (default), "ignore", or "error".
Provider selection & fallbacks
from anysearch import AnySearch
client = AnySearch(provider="exa", fallbacks=["tavily", "brave"])
resp = client.search("rust async runtimes", mode="deep")
print(resp.answer, len(resp.results))
import { AnySearch } from "@dhruv-anand-aintech/anysearch";
const client = new AnySearch({ provider: "exa", fallbacks: ["tavily", "brave"] });
const resp = await client.search("rust async runtimes", { mode: "deep" });
Set ANYSEARCH_PROVIDER to force a default provider for the whole process.
FastAPI proxy
The Python package includes an optional proxy server inspired by LiteLLM Proxy: bearer
auth, centralized provider routing/fallbacks, OpenAI-style /v1/models and /v1/search,
native /search, health checks, and simple in-process request limits.
export ANYSEARCH_PROXY_KEYS="dev-key"
export EXA_API_KEY="..."
anysearch-proxy
curl -X POST http://localhost:4000/v1/search \
-H "Authorization: Bearer dev-key" \
-H "Content-Type: application/json" \
-d '{"model":"exa","query":"best vector databases","max_results":3}'
MCP server
A self-contained stdio MCP server ships with both SDKs. It exposes the available
providers dynamically based on which API keys are set (and, with --probe, which keys
actually work).
# Python
anysearch-mcp
anysearch-mcp --probe
# Node
npx anysearch-mcp
Example client config (Cursor / Claude Desktop style):
{
"mcpServers": {
"anysearch": {
"command": "anysearch-mcp",
"env": { "EXA_API_KEY": "...", "TAVILY_API_KEY": "...", "BRAVE_API_KEY": "..." }
}
}
}
Tools
search— unified search. Theproviderenum adapts to your configured keys.list_providers— every provider, its capabilities, and whether it's configured.check_providers— runs a tiny live query to report which providers actually work.migrate_codebase— scans a repo for direct search-API usage (SDK imports, client constructors, REST endpoints for the supported providers) and returns precise call sites with suggested unifiedanysearchreplacements, so an agent can mechanically migrate it.
Provider capability matrix
Interactive comparison of all provider columns (unified params + response fields), same interaction model as compare.ainorthstar.tech:
https://compare-anysearch.ainorthstar.tech
Source: docs/tools/search_matrix/ · Worker: worker/matrix.js · Regenerate with
npm run matrix:sync after provider changes.
Repository layout
anysearch/
├── python/ # anysearch-sdk — SDK + anysearch-mcp (install from GitHub, see above)
├── js/ # anysearch — SDK + anysearch-mcp (install from GitHub, see above)
├── worker/ # Cloudflare Worker for the compare matrix site
├── docs/ # PROVIDERS.md + search_matrix data
└── scripts/ # generate_search_matrix_data.py
Development
# Python
cd python && python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]" && pytest && ruff check src
# JavaScript
cd js && npm install && npm run build && npm test
License
MIT — see LICENSE.