BerriAI/litellm · error · ValueError

advisor tool definition sets 'api_base'=

Error message

advisor tool definition sets 'api_base'={api_base!r}, which must use the https scheme.

What it means

Error "advisor tool definition sets 'api_base'={api_base!r}, which must use the https scheme." thrown in BerriAI/litellm.

Solutions

  1. Change the advisor tool 'api_base' to an https:// URL.

When it happens

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

Appendix: source

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

    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


def _make_synthetic_advisor_tool() -> dict:
    """Build a regular tool definition the executor provider can understand."""
    return {
        "name": "advisor",
        "description": ADVISOR_TOOL_DESCRIPTION,
        "input_schema": {
            "type": "object",

View on GitHub (pinned to 77b7c6c40c)