DEV Community

Tarek Etman for SpecStream

Posted on

Drop-In Migration from Firecrawl, Exa, and Tavily Without Rewriting Your Agent Stack

Most agent stacks don't call a search or scrape API directly. They call it through something: LangChain's TavilySearch, exa_py, firecrawl-py, GPT Researcher's retrievers, LobeHub's search plugin, an MCP server. Switching providers by rewriting the integration means touching every one of those, and re-testing every parser that reads the JSON back.

So we built the other kind of migration. SpecStream answers Firecrawl's, Exa's, Tavily's and Perplexity's own request formats at their own paths and returns their JSON shapes. The switch is the base URL and the API key. The SDK, the request body and the response parser stay as they are.

This post covers the diffs, the parts of each reply that differ, and the per-1,000 math with sources.

The four routes

You use Old base URL New base URL Key goes in Paths answered
Firecrawl https://api.firecrawl.dev https://api.specstream.ai/firecrawl Authorization: Bearer /v1/scrape, /v1/search, /v2/scrape, /v2/search, /v2/map, /v2/crawl
Exa https://api.exa.ai https://api.specstream.ai/exa x-api-key /search, /contents
Tavily https://api.tavily.com https://api.specstream.ai/tavily Authorization: Bearer /search, /extract, /map
Perplexity https://api.perplexity.ai https://api.specstream.ai/perplexity Authorization: Bearer /search, /chat/completions

The core search and scrape paths also answer under https://api.specstream.ai/compat/<provider>, for clients that want an explicit compatibility path. Perplexity's chat route is only at /perplexity.

The key header is whichever one the original SDK already sends. A request with no key gets the provider's own error shape back, for example from the Exa route:

$ curl -s -X POST https://api.specstream.ai/exa/search -H 'content-type: application/json' -d '{"query":"x402"}'
{"requestId": "", "error": "Missing API key. Send your SpecStream API key in an x-api-key header. …", "tag": "MISSING_API_KEY"}
Enter fullscreen mode Exit fullscreen mode

That matters more than it looks. An SDK that parses provider errors into typed exceptions keeps raising the right exception class.

Firecrawl

- curl -X POST https://api.firecrawl.dev/v2/scrape \
-   -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
+ curl -X POST https://api.specstream.ai/firecrawl/v2/scrape \
+   -H "Authorization: Bearer $SPECSTREAM_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"url": "https://example.com/pricing", "formats": ["markdown"]}'
Enter fullscreen mode Exit fullscreen mode

firecrawl-py:

  from firecrawl import Firecrawl
- app = Firecrawl(api_key=os.environ["FIRECRAWL_API_KEY"])
+ app = Firecrawl(api_key=os.environ["SPECSTREAM_API_KEY"], api_url="https://api.specstream.ai/firecrawl")
  doc = app.scrape("https://example.com/pricing", formats=["markdown"])
  hits = app.search("open source vector databases", limit=10)
Enter fullscreen mode Exit fullscreen mode

The JS SDK (@mendable/firecrawl-js) takes the same base URL. LobeHub's Firecrawl setting takes https://api.specstream.ai/firecrawl/v2. The Firecrawl loaders in GPT Researcher, LangChain and LlamaIndex work through firecrawl-py.

What differs in the reply:

  • A scrape returns data.markdown (main text, without menus, footers or ads) and data.metadata (sourceURL, url, statusCode, title, publishedTime). It does not return data.html or data.rawHtml. If your pipeline parses HTML, keep that step on a raw fetch.
  • A search returns data.web[] only. With scrapeOptions.formats: ["markdown"], each result carries the part of its page closest to the query, up to about 3,500 characters. For the whole page, call /v2/scrape.
  • Scrape also reads PDF, Word and Excel URLs. A page that returns no text gets success: false, and nothing is charged.

Full field-by-field table: Firecrawl migration guide.

Exa

- curl -X POST https://api.exa.ai/search \
-   -H "x-api-key: $EXA_API_KEY" \
+ curl -X POST https://api.specstream.ai/exa/search \
+   -H "x-api-key: $SPECSTREAM_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"query": "open source vector databases", "numResults": 10}'
Enter fullscreen mode Exit fullscreen mode

exa_py:

  from exa_py import Exa
- exa = Exa(api_key=os.environ["EXA_API_KEY"])
+ exa = Exa(api_key=os.environ["SPECSTREAM_API_KEY"], base_url="https://api.specstream.ai/exa")
Enter fullscreen mode Exit fullscreen mode

The other integrations need no code change, only settings:

  • LangChain (langchain-exa 1.1.0): ExaSearchRetriever(exa_base_url="https://api.specstream.ai/exa").
  • Exa's MCP server: set EXA_API_BASE_URL=https://api.specstream.ai/exa and put the SpecStream key in EXA_API_KEY. web_search_exa works as before.

How type maps: a type that starts with deep runs our default search ($5 per 1,000). auto, fast, lite and the rest run the fast search ($1 per 1,000). contents.text fills each result with the text of the page closest to the query, cut to maxCharacters, at no extra cost.

Guide: Exa migration.

Tavily

- curl -X POST https://api.tavily.com/search \
-   -H "Authorization: Bearer $TAVILY_API_KEY" \
+ curl -X POST https://api.specstream.ai/tavily/search \
+   -H "Authorization: Bearer $SPECSTREAM_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"query": "Who founded Mistral AI and when?", "max_results": 5}'
Enter fullscreen mode Exit fullscreen mode

tavily-python:

  from tavily import TavilyClient
- client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"])
+ client = TavilyClient(api_key=os.environ["SPECSTREAM_API_KEY"], api_base_url="https://api.specstream.ai/tavily")
Enter fullscreen mode Exit fullscreen mode

LangChain (langchain-tavily 0.2.18): TavilySearch(api_base_url="https://api.specstream.ai/tavily").

search_depth: "basic" costs $1 per 1,000 calls and "advanced" costs $5. /extract is billed per page at the Extract API rate.

Guide: Tavily migration.

Perplexity

Perplexity has two APIs, and so does the compatible route.

Search API (POST /search, ranked results):

  from perplexity import Perplexity
- client = Perplexity(api_key=os.environ["PERPLEXITY_API_KEY"])
+ client = Perplexity(api_key=os.environ["SPECSTREAM_API_KEY"], base_url="https://api.specstream.ai/perplexity")
Enter fullscreen mode Exit fullscreen mode

Your code reads results[].title, url, snippet and date as before. The price is $1 per 1,000 for up to 10 results, against Perplexity's published $5 per 1,000.

Sonar-style chat (POST /perplexity/chat/completions) is a different product behind the same base URL. Perplexity's docs say support for Sonar Chat Completions ended on September 27, 2026, so this route is for clients still written against that format.

  • What it returns. The route answers in Chat Completions form with a cited research report, not a single search.
  • Model. Send "model": "specstream-research". A call without it gets 400 with "Send model: specstream-research.".
  • Cost. A report is billed once, at delivery: $0.10 at quick depth, $0.30 at standard, $1 at deep (see pricing).
  • Timeouts. A research run takes minutes, not a chat turn's seconds, so raise the client timeout or use streaming.

Guide: Perplexity migration.

The per-1,000 math

Each provider's rates below are from its own pricing page, as cited on our migration guides (read Nov 9, 2026). Check the current pages before you plan a budget.

Search, per 1,000 Page text, per 1,000 Billing
SpecStream drop-in $1 (fast, up to 10 results) $0.80 (no charge for a page with no text) Prepaid balance; top-up credit never expires
Firecrawl Standard $1.98 at full plan use (2 credits per search) $0.99 at full plan use (1 credit per page) $99/month for 100,000 credits
Exa $7 (auto/fast), $4 (lite) $1 per content type Pay per request
Tavily $8 basic, $16 advanced Billed in credits $0.008 per credit, pay as you go
Perplexity Search API $5 n/a Pay per request

Plan-based prices only reach their per-unit rate if you use the whole plan each month. A prepaid balance that never expires has no such gap.

New accounts get $10 of credit with no card, which covers 10,000 fast searches or 12,500 pages. That's enough to run your eval set through the drop-in route before changing production config. Monthly plans (Starter $49, Growth $199, Scale $499) add higher rate limits and invoices. To estimate the savings on your own call volume, the 1-line converter takes a pasted request and prints the diff and the monthly cost.

Latency

Every drop-in route runs the fast search unless the call asks for an answer or the provider's "thorough" mode. Measured in production on Nov 9, 2026, at 1 to 20 searches a second:

  • 718 of 720 calls answered.
  • Median 0.82 s at 1 search/s, and 1.07 s at 20 searches/s.
  • p95 between 1.09 s and 1.73 s across the run.

There's no per-key or daily cap. A busy minute returns 429 with Retry-After and charges nothing.

For accuracy, the benchmarks page covers 10 public benchmarks. Two examples: 64.0 item F1 across all 200 WideSearch tasks for search, and 0.914 F1 on WCXB for extraction. Each score links to its method. The web search API comparison puts them next to the other providers.

Two per-key settings worth turning on during a migration

curl -X POST https://api.specstream.ai/v1/account/keys \
  -H "Authorization: Bearer $SPECSTREAM_API_KEY" -H "Content-Type: application/json" \
  -d '{"name": "production", "scopes": ["account:read", "finds:spend"], "spend_cap_cents": 500000, "zero_retention": true}'
Enter fullscreen mode Exit fullscreen mode
  • spend_cap_cents is a hard ceiling on what the key can spend. Set it while a new route is in shadow traffic.
  • zero_retention means searches made with that key keep no request text and no answer after the reply. They're not in history, not reused for another call, and not in log lines.

If you'd rather drop the compatibility layer later

The compatible routes are there so you don't have to migrate everything at once. The native endpoints take the same key. GET /v1/web-search returns up to 100 results and a direct answer with its source page. POST /v1/extract reads up to 20 URLs a call. The MCP server at https://api.specstream.ai/mcp exposes search_web and read_pages to Claude, Cursor, VS Code and other MCP clients:

{
  "mcpServers": {
    "specstream": {
      "url": "https://api.specstream.ai/mcp",
      "headers": { "Authorization": "Bearer YOUR_SPECSTREAM_API_KEY" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

A practical order: switch the base URL in staging, replay a day of real queries, diff the parsed results against the old provider, then flip production. Nothing in your agent code needs to change for that test.


Links

Top comments (0)