OpenAI request timeout

Hey!

I am currently running some tests against the classification endpoint using the OpenAI library. Every few requests, a request starts taking a lot of time, seconds (if not minutes). I would like to timeout the request in that case after a few seconds. I’ve found a similar thread here.
The proposed solution does not work since the timeout parameter is not there anymore.
Does anyone know a simple solution to this problem except for using the REST API?
In addition to that, is there anything from OpenAIs side that might cause the request taking so long?

Thanks for your help!