BerriAI/litellm · error · Exception

Trying to use Llama GuardYou must be a LiteLLM Enterprise us

Error message

Trying to use Llama GuardYou must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. 
Pricing: https://www.litellm.ai/#pricing

What it means

Raised at startup after the Llama Guard import succeeds but premium_user is not True. LiteLLM resolves premium status from the LITELLM_LICENSE environment variable (checked against the enterprise license service); with no/invalid license, enterprise callbacks like llamaguard_moderations refuse to run. The message appends the not-premium-user boilerplate pointing at LITELLM_LICENSE and the trial-key URL.

Source

Thrown at litellm/proxy/common_utils/callback_utils.py:196

                params: dict[str, Any] = {
                    "logging_only": presidio_logging_only,
                    **_presidio_params,
                }
                pii_masking_object = _OPTIONAL_PresidioPIIMasking(**params)
                imported_list.append(pii_masking_object)
            elif isinstance(callback, str) and callback == "llamaguard_moderations":
                try:
                    from litellm_enterprise.enterprise_callbacks.llama_guard import (
                        _ENTERPRISE_LlamaGuard,
                    )
                except ImportError:
                    raise Exception(
                        "MissingTrying to use Llama Guard" + CommonProxyErrors.missing_enterprise_package.value
                    )

                if premium_user is not True:
                    raise Exception("Trying to use Llama Guard" + CommonProxyErrors.not_premium_user.value)

                llama_guard_object = _ENTERPRISE_LlamaGuard()
                imported_list.append(llama_guard_object)
            elif isinstance(callback, str) and callback == "hide_secrets":
                try:
                    from litellm_enterprise.enterprise_callbacks.secret_detection import (
                        _ENTERPRISE_SecretDetection,
                    )
                except ImportError:
                    raise Exception(
                        "Trying to use Secret Detection" + CommonProxyErrors.missing_enterprise_package.value
                    )

                if premium_user is not True:
                    raise Exception("Trying to use secret hiding" + CommonProxyErrors.not_premium_user.value)

                _secret_detection_object = _ENTERPRISE_SecretDetection()
                imported_list.append(_secret_detection_object)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set a valid license: export LITELLM_LICENSE=<key> on every proxy process (docker -e, helm values, unit Environment=).
  2. No license yet? Get the 7-day trial key from https://www.litellm.ai/enterprise#trial.
  3. Restart the proxy after setting the variable; premium status is evaluated at callback load.
  4. If you do not intend to license, drop the callback from config.

Example fix

# before
docker run ... litellm/litellm  # LITELLM_LICENSE missing

# after
docker run -e LITELLM_LICENSE=$LITELLM_LICENSE ... litellm/litellm
Defensive patterns

Strategy: validation

Validate before calling

import os

if 'llamaguard_moderations' in desired_callbacks and not os.environ.get('LITELLM_LICENSE'):
    raise SystemExit('llamaguard_moderations requires LITELLM_LICENSE; set it or drop the callback')

Prevention

When it happens

Trigger: litellm-enterprise installed and callbacks: ['llamaguard_moderations'] configured, but the proxy process has no LITELLM_LICENSE env var, an expired trial, or a license for a different deployment count.

Common situations: Trials expiring; env var set in the shell but not in the systemd unit/docker container running the proxy; license configured on one replica but not others; local dev against a prod license file that is not mounted.

Related errors


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