openai-python
openai-python copied to clipboard
OpenAI APR error code
Describe the bug
API Error on OpenAI when calling in the visual studio code. I don't know how to fix this.
raise error.APIConnectionError( openai.error.APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')))
To Reproduce
- install visual studio code
- enter: import openai
openai.api_key = "API Key"
completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Write an essay about penguins"}]) print(completion.choices[0].message.content) 3. Run: issue occurred
Code snippets
No response
OS
window
Python version
Python v2022.10.0
Library version
n/a
Hi @newmagicjosh,
I'm not able to reproduce this on my end. I suspect there might be some sort of certificate issue on your end. If you have any other details that might help diagnose the issue, I'd be happy to look again.
what do you mean by certificate issue? What certificate issues I can get? I need to know more specifically to work and make this happen.
Thank you
I suspect some part of your configuration is unable to validate your local SSL cert. Maybe try something like https://komodor.com/learn/how-to-fix-ssl-certificate-problem-unable-to-get-local-issuer-certificate-git-error/ to fix this issue?
In the meantime, since I don't think this is an issue with the openai repo, I'm going to close this issue.