Skip to content

fix(google): enable Vertex AI in Gemini TTS for GOOGLE_GENAI_USE_VERTEXAI=1 - #2871

Open
ninglinLiu wants to merge 2 commits into
livekit:mainfrom
ninglinLiu:fix/google-tts-vertexai-env
Open

ninglinLiu wants to merge 2 commits into
livekit:mainfrom
ninglinLiu:fix/google-tts-vertexai-env

Conversation

@ninglinLiu

Copy link
Copy Markdown

Description

The Google plugin reads GOOGLE_GENAI_USE_VERTEXAI in three places, and they disagree. LLM and the realtime model enable Vertex AI for true or 1, which is also what the plugin README documents ("Set to true or 1 to enable Vertex AI"). The beta Gemini TTS only checked for 'true', so with GOOGLE_GENAI_USE_VERTEXAI=1 it silently used the Gemini Developer API instead: it threw API key is required ... GOOGLE_API_KEY when no API key was set, or sent requests to the Developer API instead of the configured Vertex project.

While checking the env vars, the README also lists GOOGLE_GENAI_API_KEY as an alternative to GOOGLE_API_KEY, but no code in the plugin reads it. LLM, TTS and the realtime model all fall back to GOOGLE_API_KEY only and throw if it is unset, so a user following the README with only GOOGLE_GENAI_API_KEY set gets an error.

Changes Made

  • plugins/google/src/beta/gemini_tts.ts: accept 'true' or '1' for GOOGLE_GENAI_USE_VERTEXAI, the same check as llm.ts and realtime_api.ts.
  • plugins/google/README.md: list only GOOGLE_API_KEY as the API key env var.
  • Tests for the TTS client options, and a patch changeset.

Pre-Review Checklist

  • Build passes: eslint and prettier pass for the changed files; the Gemini TTS tests pass locally
  • AI-generated code reviewed: prepared with the help of an AI coding assistant; I reviewed the diff and compared it with the existing checks in llm.ts and realtime_api.ts
  • Changes explained
  • Scope appropriate: limited to how the Google plugin reads its env vars

Testing

  • Automated tests added in gemini_tts.test.ts: GOOGLE_GENAI_USE_VERTEXAI=true and =1 create a Vertex AI client for the configured project, and an unset value uses the API key. The =1 case fails on main and passes with this change.
  • vitest run plugins/google/src/beta/gemini_tts.test.ts: 21 passed, 1 skipped (the live-provider test)

@ninglinLiu
ninglinLiu requested a review from a team as a code owner October 27, 2026 06:12
@changeset-bot

changeset-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b5fc2a2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@livekit/agents-plugin-google Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-anthropic Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-azure Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-krisp Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-meta Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-protoface Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-speechify Patch
@livekit/agents-plugin-synthesia Patch
@livekit/agents-plugin-tavus Patch
@livekit/agents-plugins-test Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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

Copy link
Copy Markdown
Contributor

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 bugs or issues to report.

Devin Review

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.

1 participant