Unable to get openai api key

hi , I have enrolled for the ChatGPT Prompt Engineering for Developers course and trying to follow the instructor lessons. However, there is the initial set up of set openai API key where I am unable to proceed, because I am not receiving SMS or whatsapp code from Open AI after giving my phone number. Looking through OPENAI forums, this seems like a bug. Could anyone advise how to proceed with hands on?

Hi, for the course you don’t have to enter your API KEY. Leave the code intact as it comes with the course and execute the cells. The notebook in the course provides you with an API KEY to work the exercises.

1 Like

Hi Juan, where can I find notebook in the course?

Hi @Terezia_Prosbova , when you start the course, you will see the screen divided into 2 sections: on the right you’ll find the video lesson and on the left you will find the notebook, side by side.

Isn’t this what you are seeing in your side?

Hello, I am trying to run the code inside the lesson, without making any changes, but it still gives me the following error. I can’t seem to figure out the issue. Please help!

Error:


AuthenticationError Traceback (most recent call last)
Cell In[4], line 12
1 prompt = f"“”
2 Your task is to help a marketing team create a
3 description for a retail website of a product based
(…)
10 Technical specifications: {fact_sheet_chair}
11 “”"
—> 12 response = get_completion(prompt)
13 print(response)

Cell In[2], line 3, in get_completion(prompt, model)
1 def get_completion(prompt, model=“gpt-3.5-turbo”):
2 messages = [{“role”: “user”, “content”: prompt}]
----> 3 response = openai.ChatCompletion.create(
4 model=model,
5 messages=messages,
6 temperature=0, # this is the degree of randomness of the model’s output
7 )
8 return response.choices[0].message[“content”]

File /usr/local/lib/python3.9/site-packages/openai/api_resources/chat_completion.py:25, in ChatCompletion.create(cls, *args, **kwargs)
23 while True:
24 try:
—> 25 return super().create(*args, **kwargs)
26 except TryAgain as e:
27 if timeout is not None and time.time() > start + timeout:

File /usr/local/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py:153, in EngineAPIResource.create(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)
127 @classmethod
128 def create(
129 cls,
(…)
136 **params,
137 ):
138 (
139 deployment_id,
140 engine,
(…)
150 api_key, api_base, api_type, api_version, organization, **params
151 )
→ 153 response, _, api_key = requestor.request(
154 “post”,
155 url,
156 params=params,
157 headers=headers,
158 stream=stream,
159 request_id=request_id,
160 request_timeout=request_timeout,
161 )
163 if stream:
164 # must be an iterator
165 assert not isinstance(response, OpenAIResponse)

File /usr/local/lib/python3.9/site-packages/openai/api_requestor.py:226, in APIRequestor.request(self, method, url, params, headers, files, stream, request_id, request_timeout)
205 def request(
206 self,
207 method,
(…)
214 request_timeout: Optional[Union[float, Tuple[float, float]]] = None,
215 ) → Tuple[Union[OpenAIResponse, Iterator[OpenAIResponse]], bool, str]:
216 result = self.request_raw(
217 method.lower(),
218 url,
(…)
224 request_timeout=request_timeout,
225 )
→ 226 resp, got_stream = self._interpret_response(result, stream)
227 return resp, got_stream, self.api_key

File /usr/local/lib/python3.9/site-packages/openai/api_requestor.py:620, in APIRequestor._interpret_response(self, result, stream)
612 return (
613 self._interpret_response_line(
614 line, result.status_code, result.headers, stream=True
615 )
616 for line in parse_stream(result.iter_lines())
617 ), True
618 else:
619 return (
→ 620 self._interpret_response_line(
621 result.content.decode(“utf-8”),
622 result.status_code,
623 result.headers,
624 stream=False,
625 ),
626 False,
627 )

File /usr/local/lib/python3.9/site-packages/openai/api_requestor.py:683, in APIRequestor._interpret_response_line(self, rbody, rcode, rheaders, stream)
681 stream_error = stream and “error” in resp.data
682 if stream_error or not 200 <= rcode < 300:
→ 683 raise self.handle_error_response(
684 rbody, rcode, resp.data, rheaders, stream_error=stream_error
685 )
686 return resp

AuthenticationError: Your authentication token is not from a valid issuer.

1 Like

Did you do any change at all to the first cell?

Hi! The bug involving the authentication token should now be fixed. Kindly try the lab again. Thank you!

1 Like

i can see two sections are there but there is nothing on left section.
please help with this

Hi Devang, I too faced the same problem. Hard refresh the page with the Shift+Ctrl+R buttons and give the page some time to load the content. It took me two hard refreshes to get the notebook.

1 Like

Thanks SalikAnwar but it’s unable to resolve my issue

Can you please share a full screeenshot? Thank you!

yes sure,


I also try hard refresh as said by imSalikAnwar, use a different browser too, log in with a different id, cleared all my cache but nothing works

hmmm that is weird. I would try turning off my anti-virus. I would also try using a different browser. Perhaps cleaning cache of your current browser or using incognito mode. Even if possible, use a different wifi network. Something is blocking the content on the middle.

1 Like

I am too facing similar error

Yes, you are right. Actually for some reason its not working on brave browser, I switched to edge and it worked!

thanks juan_olano,
you are correct my wifi network blocking some content, by using VPN I am able to solve my problem.

I am using Edge, and the screen is split…
like I see 2 halves.
but I am not able to type anything…
what do I do ?

Please check out some of the proposed ideas on this thread and let us know.

1 Like

I was facing the same issue as “Devang_Gangwar”.
From all the proposed solutions provided by “Juan_Olano” VPN worked for me. Thank you Juan.