First AI code not working. Tried creating 2 API keys but problem persists

/python3.11/site-packages/openai/_base_client.py", line 958, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File “/home/runner/01AIintro/.pythonlibs/lib/python3.11/site-packages/openai/_base_client.py”, line 916, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File “/home/runner/01AIintro/.pythonlibs/lib/python3.11/site-packages/openai/_base_client.py”, line 958, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File “/home/runner/01AIintro/.pythonlibs/lib/python3.11/site-packages/openai/_base_client.py”, line 930, in _request
raise self._make_status_error_from_response(err.response) from None
openai.RateLimitError: Error code: 429 - {‘error’: {‘message’: ‘You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.’, ‘type’: ‘insufficient_quota’, ‘param’: None, ‘code’: ‘insufficient_quota’}}

This is the error message.

I tried creating 2 API keys and adding the secret in my code but it is still showing the error. Please guide me with the next steps


This is the usage page of the API key on OpenAI.

Please make sure you have enough credits for the API keys . If you don’t have , then try making another new profile in the OpenAI platform and generate an API key there to use it .

How do I check for existing credits? The usage page doesn’t show anything

Hi @rishav.goswami.ug21

The error you are facing is because you have exhausted the Open AI credits. One quick solution for this is to create a new Open AI account with a new email id and phone number. This way you will get new quota of Open AI credits.

I loged in with new email id but still I didn’t get any credit. What am I supposed to do

Hi @debashree0809

Please try creating a new open ai account using a new combination of email id and phone number. Both the email email id and the phone number have to be new. You should get new credits are following this step.

Do try this and let us know.

I’ve tried with new phone number and new email id, but still I didn’t get any credit. For that reason, I’m not being able to use the API keys and proceed further with the course.

@debashree0809 the screenshot indicates that your email verification is pending. Can you complete the same and then check if the credits are appearing after the verification is done?

I did try to create a new API key from a new phone number and email id. It is still not giving me any free credits. I don’t have another new phone number to use and I’m stuck with the course. Kindly help

Hi @rishav.goswami.ug21

We had another student who was facing a similar issue. She was able to resolve the issue by creating a new account from different email id and phone number . for example by creating account using your friends or other family member’s phone and email.

Alternatively you can log in to https://platform.openai.com/ to check the credits:

  • after login, on the sidebar, go to usage → on the right hand side the credit usage will be displayed.
  • Ideally if you have received the credits, the quota has to be $5. If not then $0

Do try this and let us know if this solves your issue.

Thanks one phone number worked. But the usage shows $0.01 use already after just running the code 2 times. Is that supposed to be problem? Should I run the codes less frequently?

Hi @rishav.goswami.ug21

The credits are deducted every time you make an api call in your project. So I would suggest you to monitor your credit usage once in a while so that you are not out of credits.

Hii, I have made a new account but still I am not getting the result in desired format.

@kumari.mansi003
We have explained how to format the output and get the information in the topic “Getting output”. Please refer to this topic. You will be able to get the output in the proper formatting.

If you face any issues let me know.