{"record":{"id":"4380766f4d278413","repo":"BerriAI/litellm","slug":"please-set-confident-api-key-in-your-environm","errorCode":null,"errorMessage":"Please set 'CONFIDENT_API_KEY=<>' in your environment variables.","messagePattern":"Please set 'CONFIDENT_API_KEY=<>' in your environment variables\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/deepeval/deepeval.py","lineNumber":30,"sourceCode":"    TraceSpanApiStatus,\n)\nfrom litellm.integrations.deepeval.utils import (\n    to_zod_compatible_iso,\n    validate_environment,\n)\n\n\n# This file includes the custom callbacks for LiteLLM Proxy\n# Once defined, these can be passed in proxy_config.yaml\nclass DeepEvalLogger(CustomLogger):\n    \"\"\"Logs litellm traces to DeepEval's platform.\"\"\"\n\n    def __init__(self, *args, **kwargs):\n        api_key: Final = os.getenv(\"CONFIDENT_API_KEY\")\n        self.litellm_environment = os.getenv(\"LITELM_ENVIRONMENT\", \"development\")\n        validate_environment(self.litellm_environment)\n        if not api_key:\n            raise ValueError(\"Please set 'CONFIDENT_API_KEY=<>' in your environment variables.\")\n        self.api = Api(api_key=api_key)\n        super().__init__(*args, **kwargs)\n\n    def log_success_event(self, kwargs, response_obj, start_time, end_time):\n        \"\"\"Logs a success event to DeepEval's platform.\"\"\"\n        self._sync_event_handler(kwargs, response_obj, start_time, end_time, is_success=True)\n\n    def log_failure_event(self, kwargs, response_obj, start_time, end_time):\n        \"\"\"Logs a failure event to DeepEval's platform.\"\"\"\n        self._sync_event_handler(kwargs, response_obj, start_time, end_time, is_success=False)\n\n    async def async_log_failure_event(self, kwargs, response_obj, start_time, end_time):\n        \"\"\"Logs a failure event to DeepEval's platform.\"\"\"\n        await self._async_event_handler(kwargs, response_obj, start_time, end_time, is_success=False)\n\n    async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):\n        \"\"\"Logs a success event to DeepEval's platform.\"\"\"\n        await self._async_event_handler(kwargs, response_obj, start_time, end_time, is_success=True)","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/deepeval/deepeval.py#L12-L48","documentation":"DeepEvalLogger.__init__ reads CONFIDENT_API_KEY from the environment and raises ValueError if it is missing — you cannot construct the logger without it. Unlike most litellm callbacks, there is no constructor argument for the key; it must be in the process environment before the callback is instantiated.","triggerScenarios":"Adding 'deepeval' to litellm.callbacks or the proxy's callback list without exporting CONFIDENT_API_KEY; also triggered when the callback is dynamically loaded (yaml callbacks) in a subprocess where the var was not propagated.","commonSituations":"Local dev shell has the var but the proxy runs in Docker/systemd without it; secrets managed only at runtime, not as env vars; CI smoke tests instantiating the logger.","solutions":["Export CONFIDENT_API_KEY in the environment of the process that creates DeepEvalLogger (get one from DeepEval's dashboard)","For containers, inject it via docker env / k8s secret so it is present at proxy startup","Verify with a quick check before enabling the callback: python -c \"import os; assert os.getenv('CONFIDENT_API_KEY')\""],"exampleFix":"# before\nlitellm.callbacks = [\"deepeval\"]  # CONFIDENT_API_KEY unset -> ValueError at init\n\n# after\nexport CONFIDENT_API_KEY=<your key>\nlitellm.callbacks = [\"deepeval\"]","handlingStrategy":"validation","validationCode":"import os\n\nassert os.getenv(\"CONFIDENT_API_KEY\"), \"Set CONFIDENT_API_KEY before enabling the deepeval callback\"","typeGuard":null,"tryCatchPattern":"try:\n    DeepEvalLogger()\nexcept ValueError as e:\n    if \"CONFIDENT_API_KEY\" in str(e):\n        raise SystemExit(\"Missing DeepEval credentials — add CONFIDENT_API_KEY to the environment\")\n    raise","preventionTips":["List every callback's required env vars in the deployment checklist and assert them at startup","Inject secrets as process env (k8s secret / docker env), not runtime config files, for this logger"],"tags":["deepeval","env-vars","callback","config"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}