BerriAI/litellm · error · ValueError

Refusing to send the server-configured

Error message

Refusing to send the server-configured {credential_name} to the caller-supplied api_base '{caller_api_base}'. Pass an explicit api_key when overriding api_base for this search provider.

What it means

Error "Refusing to send the server-configured {credential_name} to the caller-supplied api_base '{caller_api_base}'. Pass an explicit api_key when overriding api_base for this search provider." thrown in BerriAI/litellm.

Solutions

  1. Pass an explicit api_key for the caller-supplied api_base instead of relying on the server-configured credential.
  2. Remove the api_base override to use the server-configured endpoint and credential.
  3. Ensure the overridden api_base matches the provider's expected host.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/base_llm/search/transformation.py:138 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/9c100d7d217378d1. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/base_llm/search/transformation.py:138

        self,
        caller_api_base: str | None,
        default_api_base: str | None,
        base_env_var: str | None,
        credential_name: str,
    ) -> None:
        """
        Block sending a server-managed credential to a caller-chosen host.

        A caller-supplied api_base is honored when constructing the request URL, so
        falling back to a server-configured secret while the caller controls the host
        leaks that secret. The provider default and the operator's own api_base
        override are the only trusted destinations for a server-managed credential.
        """
        if not caller_api_base:
            return
        if _is_trusted_search_api_base(caller_api_base, default_api_base, base_env_var):
            return
        raise ValueError(
            f"Refusing to send the server-configured {credential_name} to the "
            f"caller-supplied api_base '{caller_api_base}'. Pass an explicit api_key "
            f"when overriding api_base for this search provider."
        )

    def resolve_server_api_key(
        self,
        *,
        caller_api_key: str | None,
        caller_api_base: str | None,
        key_env_vars: tuple[str, ...],
        base_env_var: str | None,
        default_api_base: str | None,
    ) -> str | None:
        """
        Resolve a single-secret search API key, falling back to a server-managed
        secret only when the request targets a trusted host.

View on GitHub (pinned to 77b7c6c40c)