BerriAI/litellm · error · ValueError

GDC only accepts a GDCH service account credential as a…

Error message

GDC only accepts a GDCH service account credential as a JSON api_key (expected "type": "gdch_service_account"). Other Google credential types are rejected so their token or external-account endpoints cannot drive server-side requests.

What it means

Error "GDC only accepts a GDCH service account credential as a JSON api_key (expected "type": "gdch_service_account"). Other Google credential types are rejected so their token or external-account endpoints cannot drive server-side requests." thrown in BerriAI/litellm.

Solutions

  1. Pass the GDCH service account JSON (with "type": "gdch_service_account") as the api_key.
  2. Do not use other Google credential types; they are rejected to prevent SSRF via token endpoints.

When it happens

Trigger: Thrown at litellm/llms/gdc/chat/transformation.py:166 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at litellm/llms/gdc/chat/transformation.py:166

            gdch_creds: Final = self._gdch_creds_cache[cache_key]

            if not getattr(gdch_creds, "valid", False) or not getattr(gdch_creds, "token", None):
                self._fetch_auth(gdch_creds, ssl_verify)

            token: Final = gdch_creds.token

        return token

    def _load_creds_from_key(self, api_key: str) -> tuple[Any, bool]:
        import google.auth

        try:
            json_obj: Final = json.loads(api_key)
        except json.JSONDecodeError:
            return None, False
        if not isinstance(json_obj, dict) or json_obj.get("type") != self._GDCH_CREDENTIAL_TYPE:
            raise ValueError(
                "GDC only accepts a GDCH service account credential as a JSON api_key "
                '(expected "type": "gdch_service_account"). Other Google credential types are '
                "rejected so their token or external-account endpoints cannot drive server-side requests."
            )
        creds, _ = google.auth.load_credentials_from_dict(json_obj)
        return creds, True

    def validate_environment(
        self,
        headers: dict,
        model: str,
        messages: list[Any],
        optional_params: dict,
        litellm_params: dict,
        api_key: str | None = None,
        api_base: str | None = None,
    ) -> dict:
        import google.auth.exceptions

View on GitHub (pinned to 77b7c6c40c)