Is it still supported to set a request timeout for request?

The request_timeout parameter is obsolete. It is from OpenAI SDK libraries before November 2023, which were revamped with an upgrade to “version 1.0.0”.

When using OpenAI SDK “client” methods, you have a timeout parameter in seconds that you can set upon instantiation. Python:

from openai import OpenAI
client = OpenAI(timeout=120)
...

A timeout used as an API parameter in an OpenAI SDK API call after that is not sent to the API, but rather, overrides that default timeout with the same mechanism being used, but just for that call.

For Python, since the underlying client timeout is being set on the httpx library module, you can also use a more granular httpx spec timeout.

The default is ten minutes.

You do not have control over OpenAI’s server-side closing of API connections by their own timeout (if that were to ever happen, like the 15 minute life of a realtime websocket).

2 Likes