BerriAI/litellm · error · Exception
Trying to use OpenAI Moderations Check,This uses the enterpr
Error message
Trying to use OpenAI Moderations Check,This uses the enterprise folder - only available on the Docker image.
What it means
Raised at startup when callbacks enables 'openai_moderations' but importing enterprise.enterprise_hooks.openai_moderation._ENTERPRISE_OpenAI_Moderation fails. Note the top-level package is 'enterprise' (not 'litellm_enterprise'): that folder ships only inside LiteLLM's official enterprise Docker image, so pip installs can never satisfy it. The error text ('This uses the enterprise folder - only available on the Docker image.') says so explicitly; the leading comma is a string-concatenation artifact.
Source
Thrown at litellm/proxy/common_utils/callback_utils.py:221
_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)
elif isinstance(callback, str) and callback == "openai_moderations":
try:
from enterprise.enterprise_hooks.openai_moderation import (
_ENTERPRISE_OpenAI_Moderation,
)
except ImportError:
raise Exception(
"Trying to use OpenAI Moderations Check,"
+ CommonProxyErrors.missing_enterprise_package_docker.value
)
if premium_user is not True:
raise Exception("Trying to use OpenAI Moderations Check" + CommonProxyErrors.not_premium_user.value)
openai_moderations_object = _ENTERPRISE_OpenAI_Moderation()
imported_list.append(openai_moderations_object)
elif isinstance(callback, str) and callback == "lakera_prompt_injection":
from litellm.proxy.guardrails.guardrail_hooks.lakera_ai import (
lakeraAI_Moderation,
)
init_params = {}
if "lakera_prompt_injection" in callback_specific_params and isinstance(
callback_specific_params["lakera_prompt_injection"], dict
):View on GitHub (pinned to 77b7c6c40c)
Solutions
- Run the official LiteLLM proxy Docker image, which contains the enterprise folder: docker run litellm/litellm.
- Or remove 'openai_moderations' from callbacks when running from pip.
- Keep in mind a license (LITELLM_LICENSE) is additionally required once the import succeeds.
- Check for the module first in custom images: python -c "import enterprise.enterprise_hooks.openai_moderation".
Example fix
# before pip install 'litellm[proxy]' && litellm --config config.yaml # config has callbacks: ["openai_moderations"] # after docker run -v $(pwd)/config.yaml:/app/config.yaml litellm/litellm --config /app/config.yaml
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
RUNNING_IN_OFFICIAL_IMAGE = importlib.util.find_spec('enterprise.enterprise_hooks.openai_moderation') is not None
if 'openai_moderations' in callbacks and not RUNNING_IN_OFFICIAL_IMAGE:
raise SystemExit('openai_moderations requires the official LiteLLM Docker image') Prevention
- Keep a matrix note: which callbacks need pip package litellm-enterprise vs the Docker-only enterprise folder.
- Smoke-test new images with python -c "import enterprise.enterprise_hooks.openai_moderation" before shipping config that uses it.
- Run moderation-needing deployments exclusively from the official image tags.
When it happens
Trigger: Running the proxy via pip (litellm[proxy] or uv) with callbacks: ['openai_moderations'] in config.yaml. The import is attempted at config load and the proxy exits immediately.
Common situations: Migrating a docker deployment to a pip/venv install (or python:slim custom images) while keeping the same config; local dev installs copying prod config; building slim images that omit the enterprise folder.
Related errors
- Trying to use Google Text Moderation,This uses the enterpris
- MissingTrying to use Llama GuardMissing litellm-enterprise p
- Trying to use Secret DetectionMissing litellm-enterprise pac
- Trying to use OpenAI Moderations CheckYou must be a LiteLLM
- Trying to use Llama GuardYou must be a LiteLLM Enterprise us
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/1dc7b16fc0657b44.
Report an issue: GitHub.