Tutorial

Migrating from Tavily to UnSearch in LangChain

Switch from Tavily to UnSearch in your LangChain agents with minimal code changes. Save up to 96% on search costs while keeping the same API interface.

Why Migrate?

  • **Cost** — UnSearch Scale plan is $0.0003/query vs Tavily's ~$0.0075
  • **Free Tier** — 5,000 queries/month vs Tavily's 1,000
  • **Open Source** — Full source code, self-hostable
  • **Zero Retention** — Optional privacy mode

The Migration

UnSearch provides Tavily-compatible API endpoints. If you're using the Tavily search tool in LangChain, migration is straightforward.

Step 1: Install the UnSearch SDK

pip install unsearch

Step 2: Update Your Agent Configuration

Replace your Tavily API key and base URL with UnSearch credentials. The request and response formats are identical, so your existing agent logic works unchanged.

Step 3: Verify

Run your existing test suite. Because the API is compatible, all your existing queries should return results in the same format.

Advanced: Using UnSearch-Specific Features

Once migrated, you can take advantage of UnSearch-specific features like multi-engine search, the Research API for deep research workflows, and zero-retention mode for privacy-sensitive applications.

Cost Comparison

For 100,000 queries/month: - Tavily: ~$750/month - UnSearch Growth: $49/month - UnSearch Self-Hosted: $0/month (just infrastructure costs)