Threads cannot be listed by API key, a measure to prevent eavesdropping by other organization members. That precludes a bulk delete by conventional methods of listing and processing (which would be dangerous anyway).
Since you can’t list them, leaving a whole bunch of garbage behind isn’t really a penalty to you, and inactive ones are removed after 60 days.
Instead you should use your own management. If a user deletes their chat in a user interface, you delete the thread. If a user logs in and you load your own storage of their chats, go through and delete the ones automatically on both sides that are no longer serviceable.