Skip to content

[Feat] Add Tavily Search API - #15770

Merged
ishaan-jaff merged 24 commits into
mainfrom
litellm_add_tavily_search_api
Oct 21, 2025
Merged

[Feat] Add Tavily Search API#15770
ishaan-jaff merged 24 commits into
mainfrom
litellm_add_tavily_search_api

Conversation

@ishaan-jaff

@ishaan-jaff ishaan-jaff commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

[Feat] Add Tavily Search API

Provides a unified interface for search, use Tavily API here

Adds https://docs.tavily.com/documentation/api-reference/endpoint/search

Relevant issue

#15314

Add Tavily Search Provider to Unified Search API

Summary

This PR adds Tavily Search API support to LiteLLM's unified search interface, enabling users to perform web searches using Tavily alongside the existing Perplexity provider. Tavily provides AI-powered search optimized for LLM applications with features like automatic parameter tuning and rich search results.

Usage

Basic Search

import litellm

# Simple Tavily search
response = litellm.search(
    query="Who is Leo Messi?",
    custom_llm_provider="tavily"
)

for result in response.results:
    print(f"{result.title}: {result.url}")
    print(f"{result.snippet}\n")

With Options

import litellm

# Search with domain filtering and max results
response = litellm.search(
    query="latest AI developments",
    custom_llm_provider="tavily",
    max_results=10,
    search_domain_filter=["techcrunch.com", "theverge.com", "wired.com"],
    country="United States"
)

Async Search

import litellm

response = await litellm.asearch(
    query="machine learning research",
    custom_llm_provider="tavily",
    max_results=5
)

Environment Setup

export TAVILY_API_KEY="tvly-your-api-key-here"

# Optional: Override API base
export TAVILY_API_BASE="https://api.tavily.com"

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🆕 New Feature
✅ Test

Changes

@vercel

vercel Bot commented Oct 21, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Oct 22, 2025 0:03am

@ishaan-jaff
ishaan-jaff merged commit b9f3f9f into main Oct 21, 2025
8 of 10 checks passed
@ishaan-berri
ishaan-berri deleted the litellm_add_tavily_search_api branch March 26, 2026 21:51
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
* add BaseSearchConfig

* add BaseSearchConfig

* validate_environment

* fix handlers

* add PerplexitySearchConfig

* add PerplexitySearchConfig

* add LiteLLM Search API module.

* add BaseSearchConfig

* add _build_search_optional_params

* add search_testing

* add BaseSearchTest

* add TestPerplexitySearch

* fix BASE

* fix handler

* add search API

* add to init

* fix: working perplexity search API

* add _hidden_params to search

* add TAVILY to LlmProviders

* add TavilySearchConfig

* add TavilySearchConfig

* TestTavilySearch

* add tavily transform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant