Realtime API close session?

Is there a way to close a session with the Realtime API?

For example, I want to talk with a agent using the Reatime API for 15 mn. After the delay: close the session automatically.

1 Like

Is this WebRTC or sockets?

1 Like

The session is in your control especially with websockets(if properly implemented) by setting timeouts in both client and server side code.

However with WebRTC, you need to set the expires_at config for the client_secret for the session.

Also, since the connection is directly between the OpenAI API and the client, when using WebRTC , the only way to automatically terminate it is to set the timeout logic in the client side code to close the session upon timeout.

2 Likes

Thank you for the idea to add a “expires_at” parameter.

2 Likes