Where do i extend the `max_session_duration` param...
# ask-ai
f
Where do i extend the
max_session_duration
param when working with an openai realtime model?
t
Thanks for reaching out, Gad. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help you extend the
max_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:
Copy code
from livekit.plugins.openai.realtime import RealtimeModel

model = RealtimeModel(
    voice="alloy",
    max_session_duration=3600,  # 1 hour session
)
In Node.js:
Copy code
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