BerriAI/litellm · error · Exception

Trying to use Llm GuardMissing litellm-enterprise package. P

Error message

Trying to use Llm GuardMissing litellm-enterprise package. Please install it to use this feature. Run `pip install litellm-enterprise`

What it means

The proxy config lists the callback 'llmguard_moderations'. The loader then tries to import litellm_enterprise.enterprise_callbacks.llm_guard._ENTERPRISE_LLMGuard. That import fails because the litellm-enterprise pip package is not installed in the proxy environment. This error fires before the premium-user check, so fixing it alone leads to error 2882 unless a license is also set.

Source

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

                    )
                except ImportError:
                    raise Exception(
                        "Trying to use Google Text Moderation,"
                        + CommonProxyErrors.missing_enterprise_package_docker.value
                    )

                if premium_user is not True:
                    raise Exception("Trying to use Google Text Moderation" + CommonProxyErrors.not_premium_user.value)

                google_text_moderation_obj = _ENTERPRISE_GoogleTextModeration()
                imported_list.append(google_text_moderation_obj)
            elif isinstance(callback, str) and callback == "llmguard_moderations":
                try:
                    from litellm_enterprise.enterprise_callbacks.llm_guard import (
                        _ENTERPRISE_LLMGuard,
                    )
                except ImportError:
                    raise Exception("Trying to use Llm Guard" + CommonProxyErrors.missing_enterprise_package.value)

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

                llm_guard_moderation_obj = _ENTERPRISE_LLMGuard()
                imported_list.append(llm_guard_moderation_obj)
            elif isinstance(callback, str) and callback == "blocked_user_check":
                try:
                    from enterprise.enterprise_hooks.blocked_user_list import (
                        _ENTERPRISE_BlockedUserList,
                    )
                except ImportError:
                    raise Exception(
                        "Trying to use Blocked User List" + CommonProxyErrors.missing_enterprise_package_docker.value
                    )

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

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Install the package: pip install litellm-enterprise (it requires an active license to actually pass the next check).
  2. Or remove 'llmguard_moderations' from litellm_settings.callbacks.
  3. After install, also set LITELLM_LICENSE so the premium_user check (error 2882) passes.

Example fix

# before: config.yaml
litellm_settings:
  callbacks: ["llmguard_moderations"]

# after: install package + license
pip install litellm-enterprise
export LITELLM_LICENSE="sk-..."
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util

def enterprise_deps_ok() -> bool:
    return importlib.util.find_spec("litellm_enterprise") is not None

assert enterprise_deps_ok(), "pip install litellm-enterprise before enabling llmguard_moderations"

Try / catch

try:
    initialize_callbacks_on_proxy(config, premium_user=premium)
except Exception as e:
    if "Missing litellm-enterprise package" in str(e):
        subprocess.run([sys.executable, "-m", "pip", "install", "litellm-enterprise"], check=False)
        raise SystemExit("retry proxy start after installing litellm-enterprise")
    raise

Prevention

When it happens

Trigger: Run the proxy with litellm_settings.callbacks containing 'llmguard_moderations' on a host or image where 'pip show litellm-enterprise' returns nothing. Common when the config was tested on the enterprise Docker image but runs elsewhere.

Common situations: Config copied between environments: works on the enterprise Docker image, fails on a plain pip install of litellm. A new team member runs the config locally without the private package. CI starts the proxy without the enterprise dependency.

Understand the failure class

Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.

Related errors


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