{"record":{"id":"d84967e8bdfefeb9","repo":"BerriAI/litellm","slug":"missing-anthropic-api-key","errorCode":null,"errorMessage":"Missing Anthropic API Key","messagePattern":"Missing Anthropic API Key","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/anthropic/batches/handler.py","lineNumber":65,"sourceCode":"        Async: Retrieve a batch from Anthropic.\n\n        Args:\n            batch_id: The batch ID to retrieve\n            api_base: Anthropic API base URL\n            api_key: Anthropic API key\n            timeout: Request timeout\n            max_retries: Max retry attempts (unused for now)\n            logging_obj: Optional logging object\n\n        Returns:\n            LiteLLMBatch: Batch information in OpenAI format\n        \"\"\"\n        # Resolve API credentials\n        api_base = api_base or self.anthropic_model_info.get_api_base(api_base)\n        api_key = api_key or self.anthropic_model_info.get_api_key()\n\n        if not api_key:\n            raise ValueError(\"Missing Anthropic API Key\")\n\n        # Create a minimal logging object if not provided\n        if logging_obj is None:\n            from litellm.litellm_core_utils.litellm_logging import (\n                Logging as LiteLLMLoggingObjClass,\n            )\n\n            logging_obj = LiteLLMLoggingObjClass(\n                model=\"anthropic/unknown\",\n                messages=[],\n                stream=False,\n                call_type=\"batch_retrieve\",\n                start_time=None,\n                litellm_call_id=f\"batch_retrieve_{batch_id}\",\n                function_id=\"batch_retrieve\",\n            )\n\n        # Get the complete URL for batch retrieval","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/anthropic/batches/handler.py#L47-L83","documentation":"Anthropic batches credential guard: no api_key param was supplied and none could be resolved from the environment, so Anthropic batch operations (retrieve etc.) cannot authenticate and the request is aborted before sending.","triggerScenarios":"Thrown at litellm/llms/anthropic/batches/handler.py:65 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the ANTHROPIC_API_KEY environment variable.","Pass api_key='...' in the request params."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}