Chat Completions API Request timed out

I run
from openai import OpenAI
client = OpenAI(api_key=api_key,timeout=60)
response =
{“role”: “system”, “content”: “You are a helpful assistant.”},
{“role”: “user”, “content”: “Who won the world series in 2020?”},
{“role”: “assistant”, “content”: “The Los Angeles Dodgers won the World Series in 2020.”},
{“role”: “user”, “content”: “Where was it played?”}
why always feedback : APITimeoutError: Request timed out.

Have you solved this problem? I had encountered the same problem as yours. I can use chatgpt but the api connection can not be establelished.

I think it’s the version of the cause, you can use openai = 0.28.0;

No timeout here.

Try a:
pip install --upgrade openai

Set an environment variable OPENAI_API_KEY

from openai import OpenAI
client = OpenAI(timeout=60)
response =
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Who won the World Series in 2020?"},
    {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
    {"role": "user", "content": "Where was it played?"}

thanks for your solution ,but I tested it and it didn’t work sucessfully!
however i use OpenAI = 0.28.1 version ,it can work sucessfully