Cannot import name 'OpenAI' from 'openai'

Try pip install openai==0.28

Worked for me

Had the same problem today. I’ using openai 1.3.2 and Python 3.10. This did the trick for me

from openai._client import OpenAI
client = OpenAI(api_key = 'API_KEY')

Since 1.3.2 came out thirteen hours ago, one wonders if you did not actually have the same problem, just the same symptom!

I updated the library (pip install --upgrade openai), and did not need any changes in the import or client code. Python 3.11.5.

This worked for me too, I’m on openai==1.3.6 with Python 3.11.6, thank you!