Welcome to the forum!
Bad Gateway means that a server in the chain after it has left OpenAI has failed, this is out of the control of OpenAI, this is an infrastructure problem that could relate to any one of a hundred connectivity providers, up to and including your ISP.
If you get this on a regular timing schedule is could be due to some heavy load systems starting up and causing interference, but as the connection needs to be maintained you can use diagnostics connectivity software to map out your connection to various servers, so called “uptime and line quality” monitors, you can also ask your ISP to monitor your connectivity for issues.
But to re-iterate, the originating service (OpenAI) cannot influence Bad Gateway errors.