icy-apple-74167
12/02/2025, 4:17 AMtall-airline-16756
12/02/2025, 4:17 AMtall-airline-16756
12/02/2025, 4:18 AMGOOGLE_API_KEY for Gemini access, and/or
◦ GOOGLE_APPLICATION_CREDENTIALS pointing to a service account JSON for Cloud STT/TTS.
Example (Python)
import os
from livekit import agents, rtc
from livekit.agents import AgentSession, Agent, room_io
from livekit.plugins import google, silero
from livekit.plugins.turn_detector.multilingual import MultilingualModel
# Set credentials (or use env vars outside code)
os.environ["GOOGLE_API_KEY"] = "YOUR_GEMINI_API_KEY"
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/path/to/service_account.json"
class GoogleAssistant(Agent):
def __init__(self) -> None:
super().__init__(
instructions="You are a helpful voice assistant using Google AI services.",
llm=google.LLM(model="gemini-2.0"), # Gemini LLM
tts=google.TTS(voice_name="en-US-Standard-H"),# Google Cloud TTS voice
)
server = agents.AgentServer()
@server.rtc_session()
async def my_agent(ctx: agents.JobContext):
session = AgentSession(
stt=google.STT(model="latest_long"), # Google Cloud STT model
llm=google.LLM(model="gemini-2.0"),
tts=google.TTS(voice_name="en-US-Standard-H"),
vad=silero.VAD.load(),
turn_detection=MultilingualModel(),
)
await session.start(
room=ctx.room,
agent=GoogleAssistant(),
room_options=room_io.RoomOptions(
audio_input=room_io.AudioInputOptions(), # use default mic input from room
),
)
# Optional: greet user via TTS
await session.generate_reply(instructions="Greet the user and ask how you can help.")
if __name__ == "__main__":
agents.cli.run_app(server)
Notes and next steps
• Adjust model names and voice parameters to match your account quotas and desired voices.
• If you want sample SSML control for TTS, I can add a short snippet showing SSML usage.
• Tell me whether you'll run this inside a serverless environment, container, or local dev machine so I can include any environment-specific tips. Sources: Google Cloud STT plugin guide | LiveKit Docs | Gemini Live API plugin | LiveKit docs | Gemini TTS plugin guide | LiveKit Docs | Google Cloud TTS integration guide | LiveKit Docs | Google Gemini LLM plugin guide | LiveKit Docsicy-apple-74167
12/02/2025, 4:21 AMtall-airline-16756
12/02/2025, 4:22 AMcredentials_file or `credentials_info`:
session = AgentSession(
stt=google.STT(model="latest_long", credentials_file="/full/path/to/service_account.json"),
...
)
or load the JSON and pass it as credentials_info.
3) Use GOOGLE_API_KEY for Gemini only (not enough for Cloud STT)
• GOOGLE_API_KEY can authenticate Gemini, but Cloud STT/TTS needs application credentials (service account JSON).
Tell me which option you'd like to try and share the OS (Linux/macOS/Windows) and whether you prefer environment variables or explicit credentials—I’ll provide the exact command or code snippet.