# Build a live translation broadcast app with the Gemini Live API and LiveKit

## Executive summary

This guide details building a real-time multilingual broadcast application using Gemini 3.5 Live Translate via the Gemini API, integrated with LiveKit and deployed on Google Cloud Run. The system efficiently manages multiple language streams by ensuring only one active translation session exists per target language, subscribing new listeners to existing sessions rather than creating redundant ones. The architecture leverages WebSockets for persistent connections and utilizes Next.js for deployment.

## Key takeaways

- Efficient Session Management: The application maintains a maximum of one session per requested target language, subscribing subsequent listeners to the existing LiveGenkit room rather than spinning up new sessions (demonstrated at 0:58).
- Deployment Architecture: The solution uses Next.js deployed on Google Cloud Run, which allows for hosting long-running WebSockets and managing the necessary stateful connections (1:39).
- Scaling Limitations: The current demo manages translation details in memory, limiting it to a single Cloud Run instance. Scaling beyond this requires externalizing state management using a database (3:20).

## Technical details

- System Flow and APIs: The process involves creating an event ID/LiveGenkit room, streaming audio (via microphone or browser tab) to the LiveKit room. The translation bridge then opens a WebSocket connection to the Gemini API for output transcription and translated audio publishing (1:28).
- Data Handling: The system receives raw PCM data as input, and the Gemini API returns server content model parts for published translated audio and output transcript text. The transcription is handled in real-time, showing interim results before solidifying into final paragraphs (2:37).
- Deployment Setup: The deployment uses a Dockerfile and requires API keys and LiveGenkit credentials (API key, secret, WebSocket URL) stored securely in Google Secret Manager on Cloud Run. The application is configured to allow public access (2:49).

## Practical implications

- The architecture demonstrates how to integrate advanced AI services (Gemini) into real-time communication platforms (LiveKit) using modern cloud deployment patterns (Cloud Run/WebSockets).
- For build engineers, this highlights the necessity of externalizing state management (e.g., moving translation bridge logic from memory to a database) when scaling stateful applications beyond single instances.
- The use of Next.js with Cloud Run is an effective pattern for hosting long-running WebSockets while maintaining scalability potential.

## Topics

Real-Time Communication, Multilingual Translation, WebSockets, Cloud Deployment (Google Cloud Run), Generative AI APIs (Gemini), Code Repository, Documentation

Source: https://www.youtube.com/watch?v=kN_iMEAi1dw
