rapid-van-16677
12/15/2025, 8:55 AMtall-airline-16756
12/15/2025, 8:55 AMtall-airline-16756
12/15/2025, 8:55 AMuv add "livekit-agents[google]~=1.2"
◦ Node.js: pnpm add @livekit/agents-plugin-google@1.x
• Authenticate with Vertex AI (use a service account key):
◦ Set GOOGLE_APPLICATION_CREDENTIALS to your service account JSON:
export GOOGLE_APPLICATION_CREDENTIALS="path/to/your-service-account-key.json"
• Optionally set project and location:
export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_CLOUD_LOCATION="us-central1"
• Update your LiveKit agent code to use the Google plugin and enable Vertex AI:
◦ Python example:
from livekit.plugins import google
session = AgentSession(
llm=google.LLM(
model="gemini-2.0-flash",
vertexai=True,
project="your-project-id", # optional if env var set
location="us-central1", # optional if env var set
),
# stt, tts, vad, etc.
)
• Node.js example:
import * as google from '@livekit/agents-plugin-google';
const session = new voice.AgentSession({
llm: google.LLM({
model: "gemini-2.0-flash",
vertexai: true,
project: "your-project-id",
location: "us-central1",
}),
// stt, tts, vad, etc.
});
• For real-time speech use (Gemini Live API), use RealtimeModel with vertexai=True (or vertexai: true in JS).
Important note: the GOOGLE_API_KEY is not used for Vertex AI—authentication is via the service account JSON.
Do you want the full code sample for Python or Node.js (including STT/TTS/VAD setup) or help creating the service account and setting the environment variables?
Sources: Gemini TTS plugin guide | LiveKit Docs | Google Gemini LLM plugin guide | LiveKit Docs | Gemini Live API plugin | LiveKit docsrapid-van-16677
12/15/2025, 8:58 AMtall-airline-16756
12/15/2025, 8:58 AMexport GOOGLE_APPLICATION_CREDENTIALS="/path/to/your-service-account-key.json"
• (Optional) Set project/location if you want to avoid passing them in code:
export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_CLOUD_LOCATION="us-central1"
2) Install the Google plugin
• Python:
uv add "livekit-agents[google]~=1.2"
• Node.js:
pnpm add @livekit/agents-plugin-google@1.x
3) Update your agent code to enable Vertex AI
• Python minimal example:
from livekit.plugins import google
session = AgentSession(
llm=google.LLM(
model="gemini-2.0-flash",
vertexai=True,
project="your-project-id", # optional if env var set
location="us-central1",
),
)
• Node.js minimal example:
import * as google from '@livekit/agents-plugin-google';
const session = new voice.AgentSession({
llm: google.LLM({
model: "gemini-2.0-flash",
vertexai: true,
project: "your-project-id",
location: "us-central1",
}),
});
4) For real-time speech models (Gemini Live), use google.realtime.RealtimeModel (or RealtimeModel in JS) with vertexai=True.
5) Test it
• Run your app; authentication will use the service account JSON you pointed to.
• If you hit permission errors, ensure the service account has Vertex AI roles (e.g., Vertex AI User) and the correct project is selected.
Which would you like next: a full end-to-end sample (including STT/TTS/VAD), a runnable example in Python or Node.js, or help verifying service account IAM roles?