BerriAI/litellm · error · ValueError

advisor tool definition sets 'api_base' without 'api_key'…

Error message

advisor tool definition sets 'api_base' without 'api_key'. A caller-supplied api_base is only honored alongside a caller-supplied api_key, so the proxy's own credentials are never sent to a caller-chosen destination.

What it means

Error "advisor tool definition sets 'api_base' without 'api_key'. A caller-supplied api_base is only honored alongside a caller-supplied api_key, so the proxy's own credentials are never sent to a caller-chosen destination." thrown in BerriAI/litellm.

Solutions

  1. Provide 'api_key' alongside 'api_base' in the advisor tool definition, or remove the custom api_base.

When it happens

Trigger: Thrown at litellm/llms/anthropic/experimental_pass_through/messages/interceptors/advisor.py:214 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/8fbe081f65abe254. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/anthropic/experimental_pass_through/messages/interceptors/advisor.py:214

    the caller-chosen ``api_base``. A caller-supplied ``api_base`` is also
    required to be https with TLS verification on, and SSRF-validated so it
    can't target a private/internal/cloud-metadata address, mirroring
    ``proxy.auth.auth_utils.check_complete_credentials``. https with TLS
    verification is required because ``validate_url`` only rewrites the
    connection to a DNS-pinned IP for http, or for https with
    ``litellm.ssl_verify`` disabled; otherwise it returns the URL unchanged
    and relies on certificate validation to block DNS rebinding, so this
    closes the same gap without threading the pinned URL through the whole
    ``anthropic_messages()`` call chain.
    """
    if not _allow_client_side_advisor_credentials():
        return None, None
    api_key: Final[str | None] = advisor_tool.get("api_key")
    api_base: Final[str | None] = advisor_tool.get("api_base")
    if api_base is None:
        return api_key, None
    if not api_key:
        raise ValueError(
            "advisor tool definition sets 'api_base' without 'api_key'. A "
            "caller-supplied api_base is only honored alongside a "
            "caller-supplied api_key, so the proxy's own credentials are "
            "never sent to a caller-chosen destination."
        )
    if not api_base.startswith("https://"):
        raise ValueError(f"advisor tool definition sets 'api_base'={api_base!r}, which must use the https scheme.")
    if getattr(litellm, "ssl_verify", True) is False:
        raise ValueError(
            "advisor tool definition sets 'api_base' but the proxy has TLS verification "
            "disabled (litellm.ssl_verify=False), so a caller-supplied api_base can't be "
            "safely validated against DNS rebinding."
        )
    if getattr(litellm, "user_url_validation", True):
        validate_url(api_base)
    return api_key, api_base

View on GitHub (pinned to 77b7c6c40c)