{"record":{"id":"f41ffde2ea481ab0","repo":"BerriAI/litellm","slug":"trying-to-use-openai-moderations-checkyou-must-be","errorCode":null,"errorMessage":"Trying to use OpenAI Moderations CheckYou 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. \nPricing: https://www.litellm.ai/#pricing","messagePattern":"Trying to use OpenAI Moderations CheckYou 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\\. \nPricing: https://www\\.litellm\\.ai/#pricing","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/common_utils/callback_utils.py","lineNumber":227,"sourceCode":"\n                if premium_user is not True:\n                    raise Exception(\"Trying to use secret hiding\" + CommonProxyErrors.not_premium_user.value)\n\n                _secret_detection_object = _ENTERPRISE_SecretDetection()\n                imported_list.append(_secret_detection_object)\n            elif isinstance(callback, str) and callback == \"openai_moderations\":\n                try:\n                    from enterprise.enterprise_hooks.openai_moderation import (\n                        _ENTERPRISE_OpenAI_Moderation,\n                    )\n                except ImportError:\n                    raise Exception(\n                        \"Trying to use OpenAI Moderations Check,\"\n                        + CommonProxyErrors.missing_enterprise_package_docker.value\n                    )\n\n                if premium_user is not True:\n                    raise Exception(\"Trying to use OpenAI Moderations Check\" + CommonProxyErrors.not_premium_user.value)\n\n                openai_moderations_object = _ENTERPRISE_OpenAI_Moderation()\n                imported_list.append(openai_moderations_object)\n            elif isinstance(callback, str) and callback == \"lakera_prompt_injection\":\n                from litellm.proxy.guardrails.guardrail_hooks.lakera_ai import (\n                    lakeraAI_Moderation,\n                )\n\n                init_params = {}\n                if \"lakera_prompt_injection\" in callback_specific_params and isinstance(\n                    callback_specific_params[\"lakera_prompt_injection\"], dict\n                ):\n                    init_params = callback_specific_params[\"lakera_prompt_injection\"]\n                lakera_moderations_object = lakeraAI_Moderation(**init_params)\n                imported_list.append(lakera_moderations_object)\n            elif isinstance(callback, str) and callback == \"aporia_prompt_injection\":\n                from litellm.proxy.guardrails.guardrail_hooks.aporia_ai.aporia_ai import (\n                    AporiaGuardrail,","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/common_utils/callback_utils.py#L209-L245","documentation":"Raised at startup when 'openai_moderations' is configured and the enterprise import succeeded (Docker image), but premium_user is not True. As with other enterprise callbacks, premium status derives from the LITELLM_LICENSE env var on the proxy process; without a valid license the OpenAI moderation hook raises this Exception with the not-premium-user boilerplate, and config load aborts.","triggerScenarios":"Official Docker image with callbacks: ['openai_moderations'] but LITELLM_LICENSE not passed (-e/--env-file forgotten), expired trial, or license invalid for the instance.","commonSituations":"docker-compose files updated with the callback but not the license env; helm chart values missing the secret; prod has the license while staging replicas do not.","solutions":["Pass the license into the container: docker run -e LITELLM_LICENSE=... litellm/litellm.","Renew/obtain a key at https://www.litellm.ai/enterprise#trial if expired.","Verify with printenv LITELLM_LICENSE inside the running container; restart after fixing.","Drop the callback if you do not plan to license this deployment."],"exampleFix":"# before\ndocker run -v $PWD/config.yaml:/app/config.yaml litellm/litellm  # LITELLM_LICENSE missing\n\n# after\ndocker run -e LITELLM_LICENSE=$LITELLM_LICENSE -v $PWD/config.yaml:/app/config.yaml litellm/litellm","handlingStrategy":"validation","validationCode":"import os, importlib.util\n\nin_image = importlib.util.find_spec('enterprise.enterprise_hooks.openai_moderation') is not None\nif 'openai_moderations' in callbacks and in_image and not os.environ.get('LITELLM_LICENSE'):\n    raise SystemExit('openai_moderations needs LITELLM_LICENSE set')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass LITELLM_LICENSE via --env-file or -e on every container that serves the proxy.","Add a deploy-time check: config callbacks containing enterprise hooks + empty license = abort.","Use the trial key for evaluation environments so devs do not hit the gate mid-testing."],"tags":["litellm","proxy","callbacks","moderation","enterprise","license","premium"],"backgroundTag":"missing-license-key","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}