How to set max tokens for OpenAI Realtime model

This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.

How do I give max tokens in the OpenAI Realtime model?

Use update_options on the model:

llm_model = openai.realtime.RealtimeModel()
llm_model.update_options(max_response_output_tokens=500)

session = AgentSession(
    llm=llm_model,
    vad=silero.VAD.load()
)