BerriAI/litellm · error · HTTPException

search_provider is required in litellm_params

Error message

search_provider is required in litellm_params

What it means

Search invocation validation: the request's litellm_params contain no 'search_provider', so the handler cannot determine which search backend to call; rejected with 400 before the litellm.asearch call is made.

Source

Thrown at litellm/proxy/search_endpoints/search_tool_management.py:590

    ```json
    {
        "status": "error",
        "message": "Authentication failed: Invalid API key",
        "error_type": "AuthenticationError"
    }
    ```
    """
    try:
        from litellm.search import asearch

        # Extract params from request
        litellm_params: Final = request.litellm_params
        search_provider: Final = litellm_params.get("search_provider")
        api_key: Final = litellm_params.get("api_key")
        api_base: Final = litellm_params.get("api_base")

        if not search_provider:
            raise HTTPException(status_code=400, detail="search_provider is required in litellm_params")

        verbose_proxy_logger.debug("Testing connection to search provider: %s", search_provider)

        # Make a simple test search query with max_results=1 to minimize cost
        test_query: Final = "test"
        response: Final = await asearch(
            query=test_query,
            search_provider=search_provider,
            api_key=api_key,
            api_base=api_base,
            max_results=1,  # Minimize results to reduce cost
            timeout=10.0,  # 10 second timeout for test
        )

        verbose_proxy_logger.debug("Successfully tested connection to %s search provider", search_provider)

        return {
            "status": "success",

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Include search_provider in litellm_params of the search tool configuration (e.g. tavily, perplexity).
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/search_endpoints/search_tool_management.py:590 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/ac178db580e8ee23. Report an issue: GitHub.