It works!

Api calls don't freeze hexchat anymore, experimenting with threads.