many-forest-60185
08/30/2025, 1:48 PMtall-airline-16756
08/30/2025, 1:48 PMtall-airline-16756
08/30/2025, 1:48 PMRealtimeModel with the right parameters. Here's a friendly example in Python to get you started:
from livekit.plugins import openai
from openai.types.beta.realtime.session import TurnDetection
# Setting up the RealtimeModel
realtime_model = openai.realtime.RealtimeModel(
model="gpt-4o-realtime-preview",
voice="alloy",
input_audio_transcription=openai.realtime.InputAudioTranscription(
model="gpt-4o-mini-transcribe"
),
turn_detection=TurnDetection(
type="server_vad",
threshold=0.5,
prefix_padding_ms=300,
silence_duration_ms=200,
create_response=True,
interrupt_response=True,
),
temperature=0.8,
modalities=["text", "audio"]
)
# Using it in an AgentSession
session = AgentSession(llm=realtime_model)
If you're working with Node.js, here’s how you can do it:
import * as openai from '@livekit/agents-plugin-openai';
const realtimeModel = new openai.realtime.RealtimeModel({
model: 'gpt-4o-realtime-preview',
voice: 'alloy',
inputAudioTranscription: {
model: 'gpt-4o-mini-transcribe',
},
turnDetection: {
type: 'server_vad',
threshold: 0.5,
prefix_padding_ms: 300,
silence_duration_ms: 200,
create_response: true,
interrupt_response: true,
},
temperature: 0.8,
modalities: ['text', 'audio'],
});
const session = new AgentSession({ llm: realtimeModel });
If you have any questions or want me to walk you through anything else, just let me know—I’m here to help!
Sources: OpenAI Realtime API integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-turn-detector/README.md | plugins/openai/src/realtime/api_proto.ts | Azure OpenAI Realtime API and LiveKit | LiveKit Docs | Azure AI Services and LiveKit | LiveKit Docsmany-forest-60185
08/30/2025, 1:49 PMtall-airline-16756
08/30/2025, 1:49 PMfrom livekit.plugins import openai, cartesia
session = AgentSession(
llm=openai.realtime.RealtimeModel(
modalities=["text"], # Text-only mode
turn_detection=None, # Disable OpenAI's turn detection
input_audio_transcription=openai.realtime.InputAudioTranscription(
model="gpt-4o-mini-transcribe"
)
),
tts=cartesia.TTS() # Swap this out for your favorite TTS provider
)
Key Points:
• Set modalities to ["text"] to turn off audio output from OpenAI.
• Disable OpenAI’s turn detection by setting turn_detection=None.
• Use input_audio_transcription to get transcription going.
• Plug in whichever TTS provider you prefer (like Cartesia, ElevenLabs, etc.).
If you want to use LiveKit’s turn detection model instead, you can pair it with a separate STT plugin (like Deepgram) for transcription and tweak the session setup. Just give me a shout if you want me to share an example for that!
Sources: examples/voice_agents/realtime_turn_detector.py | OpenAI Realtime API integration guide | LiveKit Docs | Azure OpenAI Realtime API and LiveKit | LiveKit Docs | Realtime model integrations | LiveKit Docs | plugins/openai/src/realtime/api_proto.tsmany-forest-60185
08/30/2025, 2:43 PMtall-airline-16756
08/30/2025, 2:43 PMfrom livekit.plugins import openai, your_llm_provider, cartesia
session = AgentSession(
llm=your_llm_provider.LLM(), # Swap this out with your preferred LLM
tts=cartesia.TTS(), # Use your go-to TTS provider here
stt=openai.realtime.RealtimeModel(
modalities=["text"], # Text-only mode for transcription
turn_detection=None, # Turning off OpenAI's turn detection
input_audio_transcription=openai.realtime.InputAudioTranscription(
model="gpt-4o-mini-transcribe"
)
)
)
Here’s what’s happening in this setup:
• The llm parameter points to your chosen LLM provider.
• OpenAI Realtime is dedicated just to transcription (stt), with turn detection turned off.
• Your preferred TTS provider takes care of converting text to speech.
If you want me to walk you through it more or share some extra examples, just let me know—I’m here to help!