What This Does: Gracefully stops the avatar server, releases GPU resources and marks the session as ended. Call this when you’re done with the conversation to avoid unnecessary charges.
Best Practice: Always explicitly call this endpoint when you’re done with a session to ensure immediate resource release and billing accuracy.
Sessions are automatically terminated instantly when:
WebSocket disconnects - When the WebSocket connection is closed or lost
Client leaves the video room - When all participants leave the Daily/LiveKit room
Session timeout - When the session reaches its expiration time based on plan limits
Safety Mechanism: If automatic termination fails for any reason, our system has a safety check that will detect and clean up orphaned sessions within 3 minutes. This ensures sessions are always terminated even in edge cases where the instant triggers don’t fire.