@junjie xu Thanks for getting back. I'm glad to see you were able to identify the cause of this issue. Thanks for posting your solution so that others experiencing the same thing can easily reference this. Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.
.
Issue:
When I request my gpt-4 model, I am getting this error every time in my program:
openai.APIConnectionError: Connection error.
.
Resolution: You have identified the cause of the issue which was due to the proxy. You hadn't turned off the proxy completely and it was interrupting the request if request time > 10s.