{"record":{"id":"0802e784f737a911","repo":"BerriAI/litellm","slug":"akto-base-url-is-required-set-akto-guardrail-api","errorCode":null,"errorMessage":"akto_base_url is required. Set AKTO_GUARDRAIL_API_BASE or pass it in litellm_params.","messagePattern":"akto_base_url is required\\. Set AKTO_GUARDRAIL_API_BASE or pass it in litellm_params\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/akto/akto.py","lineNumber":88,"sourceCode":"    ) -> None:\n        \"\"\"Initialize the Akto guardrail.\n\n        Args:\n            akto_base_url: Akto API base URL. Falls back to AKTO_GUARDRAIL_API_BASE env var.\n            akto_api_key: Akto API key. Falls back to AKTO_API_KEY env var.\n            akto_account_id: Akto account ID. Falls back to AKTO_ACCOUNT_ID env var, then \"1000000\".\n            akto_vxlan_id: Akto VXLAN ID. Falls back to AKTO_VXLAN_ID env var, then \"0\".\n            unreachable_fallback: Behavior when Akto is unreachable — block or allow.\n            guardrail_timeout: HTTP timeout in seconds for Akto API calls.\n        \"\"\"\n        self.async_handler = get_async_httpx_client(\n            llm_provider=httpxSpecialProvider.GuardrailCallback,\n        )\n        self.background_tasks: set = set()\n\n        self.akto_base_url = (akto_base_url or os.environ.get(\"AKTO_GUARDRAIL_API_BASE\", \"\")).rstrip(\"/\")\n        if not self.akto_base_url:\n            raise ValueError(\"akto_base_url is required. Set AKTO_GUARDRAIL_API_BASE or pass it in litellm_params.\")\n\n        self.akto_api_key = akto_api_key or os.environ.get(\"AKTO_API_KEY\", \"\")\n        if not self.akto_api_key:\n            raise ValueError(\"akto_api_key is required. Set AKTO_API_KEY or pass it in litellm_params.\")\n\n        self.unreachable_fallback: Literal[\"fail_closed\", \"fail_open\"] = unreachable_fallback\n        self.guardrail_timeout = guardrail_timeout or DEFAULT_GUARDRAIL_TIMEOUT\n        self.akto_account_id = akto_account_id or os.environ.get(\"AKTO_ACCOUNT_ID\", \"1000000\")\n        self.akto_vxlan_id = akto_vxlan_id or os.environ.get(\"AKTO_VXLAN_ID\", \"0\")\n\n        kwargs[\"supported_event_hooks\"] = list(self.get_supported_event_hooks())\n        super().__init__(**kwargs)\n\n        verbose_proxy_logger.debug(\n            \"Akto guardrail initialized: base_url=%s fallback=%s\",\n            self.akto_base_url,\n            self.unreachable_fallback,\n        )","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/akto/akto.py#L70-L106","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/akto/akto.py:88 when the library encounters an invalid state.","commonSituations":"The Akto guardrail base URL is not configured.","solutions":["Set AKTO_GUARDRAIL_API_BASE or pass akto_base_url in litellm_params."],"exampleFix":"export AKTO_GUARDRAIL_API_BASE=https://your-akto-host","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}