{"record":{"id":"3c03e99f0c942031","repo":"BerriAI/litellm","slug":"github-copilot-api-key-is-required-please-authent","errorCode":null,"errorMessage":"GitHub Copilot API key is required. Please authenticate via OAuth Device Flow.","messagePattern":"GitHub Copilot API key is required\\. Please authenticate via OAuth Device Flow\\.","errorType":"exception","errorClass":"AuthenticationError","httpStatus":401,"severity":"error","filePath":"litellm/llms/github_copilot/embedding/transformation.py","lineNumber":66,"sourceCode":"    def validate_environment(\n        self,\n        headers: dict,\n        model: str,\n        messages: list,\n        optional_params: dict,\n        litellm_params: dict,\n        api_key: str | None = None,\n        api_base: str | None = None,\n    ) -> dict:\n        \"\"\"\n        Validate environment and set up headers for GitHub Copilot API.\n        \"\"\"\n        try:\n            # Get GitHub Copilot API key via OAuth\n            api_key = self.authenticator.get_api_key()\n\n            if not api_key:\n                raise AuthenticationError(\n                    model=model,\n                    llm_provider=\"github_copilot\",\n                    message=\"GitHub Copilot API key is required. Please authenticate via OAuth Device Flow.\",\n                )\n\n            # Get default headers\n            default_headers: Final = get_copilot_default_headers(api_key)\n\n            # Merge with existing headers (user's extra_headers take priority)\n            merged_headers: Final = {**default_headers, **headers}\n\n            verbose_logger.debug(\"GitHub Copilot Embedding API: Successfully configured headers for model %s\", model)\n\n            return merged_headers\n\n        except GetAPIKeyError as e:\n            raise AuthenticationError(\n                model=model,","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/github_copilot/embedding/transformation.py#L48-L84","documentation":"Error \"GitHub Copilot API key is required. Please authenticate via OAuth Device Flow.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/github_copilot/embedding/transformation.py:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Authenticate via the GitHub Copilot OAuth Device Flow so litellm can obtain an API key before calling embeddings."],"exampleFix":null,"handlingStrategy":null,"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"}