Does anyone help me to fix it : openai.error.APIConnectionError

Is there any one help me to fix it?
My code below:
import openai
openai.api_key = “XXXXXXXXXXX”

将文本传递给 OpenAI API 进行处理

def generate_text(prompt):
response = openai.Completion.create(
engine=“davinci”,
prompt=prompt,
max_tokens=60,
n=1,
stop=None,
temperature=0.5,
)
text = response.choices[0].text
return text.strip()

一个示例使用场景

prompt = “在一个阳光明媚的早晨,一个年轻人走进了一家咖啡店。”
generated_text = generate_text(prompt)
print(generated_text)

openai.error.APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host=‘api.openai.com’, port=443): Max retries exceeded with url: /v1/engines/davinci/completions (Caused by ProxyError(‘Cannot connect to proxy.’, OSError(0, ‘Error’)))

Process finished with exit code 1

1 Like

I’m from China and you use v2ray with Vultr VPS to access the global internet. I am wondering if my IP address from Vultr has been banned by openai api server.

did you solve the problem? I am experiencing the same trouble.

It seems all IP from vultr be banned. I’m stuck by the same trouble too.
Are there some bad things between openai and vultr?