BerriAI/litellm · error · ValueError

akto_base_url is required. Set AKTO_GUARDRAIL_API_BASE or pa

Error message

akto_base_url is required. Set AKTO_GUARDRAIL_API_BASE or pass it in litellm_params.

What it means

Raised while initializing the Akto guardrail when no base URL is available: neither the akto_base_url litellm_params entry nor the AKTO_GUARDRAIL_API_BASE environment variable was provided. Every subsequent Akto API call needs that endpoint, so the guardrail fails to construct at load time; the message names both configuration sources.

Source

Thrown at litellm/proxy/guardrails/guardrail_hooks/akto/akto.py:88

    ) -> None:
        """Initialize the Akto guardrail.

        Args:
            akto_base_url: Akto API base URL. Falls back to AKTO_GUARDRAIL_API_BASE env var.
            akto_api_key: Akto API key. Falls back to AKTO_API_KEY env var.
            akto_account_id: Akto account ID. Falls back to AKTO_ACCOUNT_ID env var, then "1000000".
            akto_vxlan_id: Akto VXLAN ID. Falls back to AKTO_VXLAN_ID env var, then "0".
            unreachable_fallback: Behavior when Akto is unreachable — block or allow.
            guardrail_timeout: HTTP timeout in seconds for Akto API calls.
        """
        self.async_handler = get_async_httpx_client(
            llm_provider=httpxSpecialProvider.GuardrailCallback,
        )
        self.background_tasks: set = set()

        self.akto_base_url = (akto_base_url or os.environ.get("AKTO_GUARDRAIL_API_BASE", "")).rstrip("/")
        if not self.akto_base_url:
            raise ValueError("akto_base_url is required. Set AKTO_GUARDRAIL_API_BASE or pass it in litellm_params.")

        self.akto_api_key = akto_api_key or os.environ.get("AKTO_API_KEY", "")
        if not self.akto_api_key:
            raise ValueError("akto_api_key is required. Set AKTO_API_KEY or pass it in litellm_params.")

        self.unreachable_fallback: Literal["fail_closed", "fail_open"] = unreachable_fallback
        self.guardrail_timeout = guardrail_timeout or DEFAULT_GUARDRAIL_TIMEOUT
        self.akto_account_id = akto_account_id or os.environ.get("AKTO_ACCOUNT_ID", "1000000")
        self.akto_vxlan_id = akto_vxlan_id or os.environ.get("AKTO_VXLAN_ID", "0")

        kwargs["supported_event_hooks"] = list(self.get_supported_event_hooks())
        super().__init__(**kwargs)

        verbose_proxy_logger.debug(
            "Akto guardrail initialized: base_url=%s fallback=%s",
            self.akto_base_url,
            self.unreachable_fallback,
        )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set AKTO_GUARDRAIL_API_BASE or pass akto_base_url in litellm_params.

Example fix

export AKTO_GUARDRAIL_API_BASE=https://your-akto-host
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/akto/akto.py:88 when the library encounters an invalid state.

Common situations: The Akto guardrail base URL is not configured.


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