famous-finland-27043
10/29/2025, 4:53 PMmax_session_duration param when working with an openai realtime model?tall-airline-16756
10/29/2025, 4:53 PMtall-airline-16756
10/29/2025, 4:54 PMmax_session_duration parameter for an OpenAI realtime model in LiveKit! You can easily set this during the initialization of the RealtimeModel instance. Here's a friendly guide to get you started:
In Python:
from livekit.plugins.openai.realtime import RealtimeModel
model = RealtimeModel(
voice="alloy",
max_session_duration=3600, # 1 hour session
)
In Node.js:
import { RealtimeModel } from '@livekit/agents';
const model = new RealtimeModel({
voice: 'marin',
maxSessionDuration: 3600000, // 1 hour session
});
Just a quick note: the parameter expects the duration in seconds for Python and milliseconds for Node.js, so be sure to adjust it according to what fits your application best. If you have any more questions or need further assistance, feel free to ask—I'm here to help!
Sources: examples/voice_agents/realtime_load_chat_history.py | plugins/openai/src/realtime/realtime_model.ts