Authentication error in Jupyter notebook

i went to the openai api key generator and got my secret api but each time i use it the same way it was described in the study videos given I kept on getting authentication error even after generating more than 1 secret api key, how can i stop the error please?

I am trying to run the Jupyter notebook in split screen but it says ‘Forbidden’ and not running. Anyone else faced this issue?
Safari on Mac.

I am facing same issue; the code runs fine in the lab but when I generate my own API key and then run it on colab it gives error

If you run the jupyter notebook in DeepLearning.AI, do not use your own API key.

Hello @TheSciPro ,

Use your api key when you do it personally in colab or jupyter notebook.

But you do not need api key when working in Deeplearning.AI labs as Deeplearng.AI provides it and has done the set up for the learners to work hassle free.

With regards,
Nilosree Sengupta

hello @nilosreesengupta
But when I used below this code

import openai
import os

from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())

openai.api_key = os.getenv(‘OPENAI_API_KEY’)

its showing authentication error , " no api key provided".
how can I resolve this?

1 Like