I’m working on Pycharm and getting this error every time I try to load openai api key:
openai.error.AuthenticationError: No API key provided. You can set your API key in code using ‘openai.api_key = ’, or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with ‘openai.api_key_path = ’. You can generate API keys in the OpenAI web interface. See OpenAI API for details.
I tried to copy the key into a txt file, but the same problem.
Hi m_tu, welcome to the community! Yes, as mentioned above, there are a few other threads where users ran into similar issues, but generally speaking, the course notebook is designed to use the course’s built-in API key. If you are building your own application, you will need to use your own API key from OpenAI, in which case it should start something like ‘sk-’. Do note that one of those options you mentioned points to the key value itself, while the other points to the key file path. Hope that helps!
@Henry.L I just started this course, and I had the same question.
“the course notebook is designed to use the course’s built-in API key.”
Does this mean I can only run the notebook on deeplearningai’s website, for example:
But can’t execute it offline in my own pyCharm? Thanks
Also, does gpt-3.5-turbo model has a usage limit? I got this error message: “openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.”
Hi Martin, yes the files should be utilizing a pre-existing python environment with a built-in API key, so you may run into some issues trying to run the notebooks as is in your own IDE like PyCharm. I would recommend trying out the notebooks in the web environment first to get a feel of things and then adapting snippets of code to put together your own offline script.
And yes, OpenAI imposes some usage limits based on your plan, which you can read more about here: [Rate Limits - OpenAI API]