OpenRouter for web search.
Choose your search providers. Keep the APIs you know. Change the base URL and key for supported APIs, and keep your existing calls.
const client = tavily({apiKey: process.env.GATEWAY_KEY,apiBaseURL:'http://localhost:3014/compat/tavily',});await client.search('AI agents');
Your existing SDK call stays the same.
Your providers. Your fallback order.
Your providers. Your routing rules.
Connect the providers you choose with your own keys. Set the order for search, news, and page extraction, then route every request through search2ai.
SEARCH1API_KEY=your_provider_keyTAVILY_KEY=your_backup_provider_keySEARCH_SERVICE=search1api,tavilyNEWS_SERVICE=tavily,search1apiCRAWL_SERVICE=search1api,jina
Add your own providers
Configure built-in providers, or implement and register a provider adapter to connect another service.
Automatic fallback
On rate limits, timeouts, or failures, try the next provider in your chain. See which provider answered and why others failed.
Optional caching
Enable in-memory caching, or use Cloudflare KV on Workers. You control the TTL.
Change your base URL and key. Keep your code.
Already using Exa, Tavily, Search1API, SearXNG, or Firecrawl? Point supported API and SDK calls at search2ai. Keep your existing calls and response parsing while the gateway routes to your configured providers.
Tavily SDK · configuration changes only — typescript diffimport { tavily } from '@tavily/core';const client = tavily({- apiKey: process.env.TAVILY_API_KEY,+ apiKey: process.env.GATEWAY_KEY,+ apiBaseURL: 'http://localhost:3014/compat/tavily',});const results = await client.search('AI agent frameworks');
Your existing SDK call stays the same.
| Existing API | Gateway endpoints |
|---|---|
| Exa | /compat/exaPOST /search, /contents |
| Tavily | /compat/tavilyPOST /search, /extract |
| Search1API | /compat/search1apiPOST /search, /news, /crawl |
| SearXNG | /compat/searxngGET/POST /search (JSON) |
| Firecrawl | /compat/firecrawlPOST /v2/scrape, /v1/scrape |
Set AUTH_KEYS on the gateway and use a gateway key in your SDK. Provider credentials stay in the gateway configuration.
Compatibility covers the documented methods and options. Native-only features need the matching provider; cross-provider translation supports a subset. Firecrawl compatibility covers single-page scraping.
Your stack. One integration.
Connect an AI client, call the HTTP API, or embed the gateway in your application.
Save your provider key in .env, start the service, then run the search request in a second terminal.
HTTP API — bash# .envSEARCH1API_KEY=your_provider_key# Terminal 1npx -y search2ai serve --host 127.0.0.1# Terminal 2curl http://localhost:3014/v1/search \-H 'Content-Type: application/json' \-d '{"query":"hono cloudflare workers","max_results":3}'
Node.js ≥ 22.18. Configure at least one provider with the capability you need. Examples use Search1API; other supported providers work too.
Search & news: Search1API, Tavily, Brave, Exa, Serper, SerpAPI, Google, SearXNG. Page extraction: Search1API, Tavily, Exa, Jina, Firecrawl. Capabilities and filters vary by provider; Google news uses date-sorted search.
Only configured providers are used. Provider credentials, quotas, and usage charges are separate from this open-source gateway.
Prefer hosted search?
Use Search1API directly, or connect it as a search2ai provider. Get search, news, and page extraction without running your own gateway.
Try Search1APIMIT licensed. Built in the open.