Skip to content

feat(google): accept a credentials object on STT and TTS - #6618

Open
biztex wants to merge 2 commits into
livekit:mainfrom
biztex:feat/google-stt-tts-credentials
Open

feat(google): accept a credentials object on STT and TTS#6618
biztex wants to merge 2 commits into
livekit:mainfrom
biztex:feat/google-stt-tts-credentials

Conversation

@biztex

@biztex biztex commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #6586

Problem

google.STT and google.TTS only authenticate via credentials_info (a service-account dict), credentials_file (a path on disk), or Application Default Credentials. Workload Identity Federation setups with custom credential providers hold a google.auth.credentials.Credentials object in memory that never exists as a file — and had no way to pass it, despite both classes already constructing their clients with credentials=<object> internally (they just insisted on deriving that object from a file first).

Change

Adds an optional credentials parameter to both google.STT and google.TTS, passed straight through to SpeechAsyncClient / TextToSpeechAsyncClient. It takes precedence over credentials_info / credentials_file, and STT skips its ADC-availability check when the object is supplied. Signature and type match the credentials parameter already accepted by RealtimeModel, LLM, and the aiplatform LLM in this same plugin — this just completes the parity, exactly as requested in the issue. Default is None, so existing callers are unaffected.

Tests

New hermetic tests/test_google_credentials.py (unit-marked; uses AnonymousCredentials, no network/files/env): constructing STT without ADC now works with a credentials object, both clients receive the exact supplied object, and the object wins over a (nonexistent) credentials_file.

google.STT and google.TTS only supported authentication via credentials_info
(a service-account dict), credentials_file (a path on disk), or Application
Default Credentials. Setups using Workload Identity Federation with custom
credential providers obtain google.auth.credentials.Credentials objects in
memory that never exist as files, and had no way to pass them.

Add an optional credentials parameter to both classes and pass it through to
the underlying SpeechAsyncClient / TextToSpeechAsyncClient, taking precedence
over credentials_info and credentials_file. Mirrors the credentials parameter
already accepted by RealtimeModel, LLM, and the aiplatform LLM in this plugin.
STT also skips the ADC availability check when a credentials object is given.

Fixes livekit#6586
@biztex
biztex requested a review from a team as a code owner July 30, 2026 15:07
devin-ai-integration[bot]

This comment was marked as resolved.

With an in-memory credentials object the ADC startup check is skipped, but
_get_recognizer still derived the project id from ambient credentials - so a
WIF setup without ADC connected fine and then failed at transcription time
with a confusing default-credentials-not-found error.

Resolve the project from the credentials object itself (project_id or
quota_project_id) when one is supplied, and when the project remains
unresolvable raise a clear error saying exactly that instead of leaking the
ADC failure.
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.

ivekit-google feature request — credentials param on STT & TTS (issue-template format)

1 participant