damp-belgium-53878
07/22/2025, 8:04 PMsession = AgentSession(
stt = openai.STT(model="gpt-4o-transcribe"),
llm = openai.realtime.RealtimeModel(model="gpt-4o-realtime-preview", voice=voice),
tts = openai.TTS(voice=voice),
vad = vad
)tall-airline-16756
07/22/2025, 8:04 PMtall-airline-16756
07/22/2025, 8:06 PMAgentSession. Your configuration is valid, and any combination of STT, LLM, TTS, or realtime API can be used in an AgentSession.
Regarding the voice audio source: the realtime model's audio output is controlled by its modalities parameter. By default, the realtime model outputs both text and audio. If you want to use a separate TTS (text-to-speech) for the voice, you should configure the realtime model to use only text modality. This ensures that the audio comes from your specified TTS component, not the realtime model.
To use the TTS as the voice source, set up your session like this:
session = AgentSession(
stt=openai.STT(model="gpt-4o-transcribe"),
llm=openai.realtime.RealtimeModel(
model="gpt-4o-realtime-preview",
voice=voice,
modalities=["text"] # Use text-only to rely on separate TTS
),
tts=openai.TTS(voice=voice),
vad=vad
)
This configuration ensures that the voice audio is generated by the TTS component, not the realtime model.
Sources: OpenAI STT integration guide | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_session.py | OpenAI Realtime API integration guide | LiveKit Docsdamp-belgium-53878
07/22/2025, 8:08 PMtall-airline-16756
07/22/2025, 8:08 PMdamp-belgium-53878
07/22/2025, 8:13 PM