DLAI Course - trouble loading OpenAI API key

My take on this would be the following:

If working within the course’s notebooks, we don’t have to provide an api key.

For other environments you can do several things:

  1. Enter the api key directly in the openai.api_key variable.
  2. Set the api key in your OS env and just call it, as is done in the notebooks of the course.
  3. Store it in a file somewhere only you have access to, and retrieve it from there. This includes retrieving it by reading the file directly or by calling it via some api, etc.

Just be sure that nobody else can access your api key.

Lets hear other learners with their thoughts and comments :slight_smile:

1 Like