Skip to content

feat(google): support universal credential types in STT and TTS credentials_file#5056

Merged
chenghao-mou merged 2 commits intolivekit:mainfrom
rafallezanko:main
Mar 13, 2026
Merged

feat(google): support universal credential types in STT and TTS credentials_file#5056
chenghao-mou merged 2 commits intolivekit:mainfrom
rafallezanko:main

Conversation

@rafallezanko
Copy link
Contributor

Previously, the Google STT and TTS plugins loaded file-based credentials using from_service_account_file, which only supports service account JSON. This prevented users from using other credential types such as Workload Identity
Federation (WIF), Google Workload Identity (GWI), or external account credentials.

Changes:

  • Replaced TextToSpeechAsyncClient.from_service_account_file (TTS) and SpeechAsyncClient.from_service_account_file (STT) with google.auth.load_credentials_from_file, which handles all credential types recognized by the google-auth
    library (service accounts, WIF external accounts, GWI, authorized user credentials, etc.)
  • The loaded credentials object is passed directly to the client constructor
  • credentials_info (dict-based) and the default ADC path are unchanged
  • Added # type: ignore[no-untyped-call] to both call sites since google-auth lacks type stubs

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@rafallezanko
Copy link
Contributor Author

Hi @chenghao-mou , can you try to have a look at the change please? :)

@chenghao-mou chenghao-mou self-assigned this Mar 12, 2026
elif is_given(self._credentials_file):
client = client_cls.from_service_account_file(
self._credentials_file, client_options=client_options
credentials, _ = google.auth.load_credentials_from_file( # type: ignore[no-untyped-call]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should save this project_id so we can reuse it later in _get_recognizer, otherwise, it might default back to the default credential.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, thanks! I've committed a fix.

Copy link
Member

@chenghao-mou chenghao-mou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Thanks!

@chenghao-mou chenghao-mou merged commit 7050a93 into livekit:main Mar 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants