feat(openai, google): Plugins for OpenAI & Gemini realtime speech-to-speech translation#6279
Open
claralp wants to merge 4 commits into
Open
feat(openai, google): Plugins for OpenAI & Gemini realtime speech-to-speech translation#6279claralp wants to merge 4 commits into
claralp wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(openai, google): realtime speech-to-speech translation models
Adds
RealtimeTranslationModelfor both OpenAI (gpt-realtime-translate) and Google Gemini (gemini-3.5-live-translate-preview). Both perform live, simultaneous speech-to-speech translation — audio in one language comes out as audio + transcript in the target language while the speaker is still talking, with no STT/TTS/VAD plugins required.New additions
livekit-plugins-openai— realtime/translation_model.pyWraps the dedicated
/v1/realtime/translationsWebSocket endpoint. Since this API has no response/turn lifecycle (only continuoussession.output_transcript.delta/session.output_audio.deltadeltas), turn boundaries are synthesized from idle gaps in the output stream: the first output delta opens a segment (GenerationCreatedEvent) and a configurable idle timeout closes it. Features:session.updateto in-flight sessionsmax_session_durationfor proactive WebSocket recyclingconn_optionsRealtimeModelMetricsper segment (TTFT, duration)openai_server_event_received/openai_client_event_queuedevents for debugginglivekit-plugins-google— realtime/translation_model.pyThin subclass of the existing
RealtimeModel/RealtimeSession. The entire connection, receive, generation, transcription, and metrics machinery is inherited unchanged — only _build_connect_config is overridden to send aTranslationConfiginstead of a conversational system prompt. Capabilitiesmutable_chat_context,mutable_instructions, andauto_tool_reply_generationare disabled to match the model's constraints.livekit-plugins-googleREADME — documents RealtimeTranslationModel, usage as anAgentSessionLLM, live language switching, and the multi-user example.examples/other/translation/realtime-multi-user-translator.pyEnd-to-end multi-user translator example, supporting both providers via
TRANSLATION_PROVIDER=openai|google. Demonstrates running one translation session per participant/direction simultaneously.Tests
tests/test_openai_realtime_translation.py— hermetic tests (no network, monkeypatched WebSocket) covering:session.updatepayload, output segment streaming and metrics, back-to-back segments, input transcription (interim → final), late-delta segment reopening, and generate_reply failure contract.tests/test_google_realtime_translation.py— hermetic tests covering model capabilities/properties, minimalLiveConnectConfig(no system instruction, tools, speech config, or session resumption), and update_options language switching.Usage (both providers are drop-in compatible)