BerriAI/litellm · error · AuthenticationError

GitHub Copilot API key is required. Please authenticate via…

Error message

GitHub Copilot API key is required. Please authenticate via OAuth Device Flow.

What it means

Error "GitHub Copilot API key is required. Please authenticate via OAuth Device Flow." thrown in BerriAI/litellm.

Solutions

  1. Authenticate via the GitHub Copilot OAuth Device Flow so litellm can obtain an API key before calling embeddings.

When it happens

Trigger: Thrown at litellm/llms/github_copilot/embedding/transformation.py:66 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/3c03e99f0c942031. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/github_copilot/embedding/transformation.py:66

    def validate_environment(
        self,
        headers: dict,
        model: str,
        messages: list,
        optional_params: dict,
        litellm_params: dict,
        api_key: str | None = None,
        api_base: str | None = None,
    ) -> dict:
        """
        Validate environment and set up headers for GitHub Copilot API.
        """
        try:
            # Get GitHub Copilot API key via OAuth
            api_key = self.authenticator.get_api_key()

            if not api_key:
                raise AuthenticationError(
                    model=model,
                    llm_provider="github_copilot",
                    message="GitHub Copilot API key is required. Please authenticate via OAuth Device Flow.",
                )

            # Get default headers
            default_headers: Final = get_copilot_default_headers(api_key)

            # Merge with existing headers (user's extra_headers take priority)
            merged_headers: Final = {**default_headers, **headers}

            verbose_logger.debug("GitHub Copilot Embedding API: Successfully configured headers for model %s", model)

            return merged_headers

        except GetAPIKeyError as e:
            raise AuthenticationError(
                model=model,

View on GitHub (pinned to 77b7c6c40c)