openai.RateLimitError: Error code: 429 for my First Script

Hello there,
I am new to programming. I was struggling to develp a simple Python script to test communicating with ChatGPT. I got a lot of errors but after trying multiple variations, I managed to develop this code;

import os
from openai import OpenAI

client = OpenAI(
# This is the default and can be omitted
api_key=“MY_API_KEY”
)

completion = client.chat.completions.create(
messages=[
{
“role”: “user”,
“content”: “Say this is a test”,
}
],
model=“gpt-3.5-turbo”,
)

response = completion.choices[0].text
print(response)

But now I am getting this:
…/.local/lib/python3.8/site-packages/openai/_base_client.py", line 1020, 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’}}

I have a free account and from HERE, I learnt the rate limit for the model that I am using i.e., gpt-3.5-turbo is , 40,000 TPM or 3 RPM, 200 RPD or 200,000 TPD

How may RateLimimt be reached when this is my the very first attempt?

Best Regards

1 Like

OpenAI’s API currently operates on a prepaid basis.
First, please check if you have any credit balance at:
https://platform.openai.com/settings/organization/billing/overview.

If you have not preloaded any credit, you will receive a 429 error.

In that case, you need to register a credit card or debit card and preload credit. Once you do this, you will be able to use the API.

3 Likes

So, we cannot integrate it even for the pilot projects?
O O. That’s kind of a bad news.

OpenAI generously gave out $18 with new accounts, but people across the globe signed up for multiple accounts, etc. They moved to $5 free on sign-up before abandoning that too. As the technology is a lot more stable now, paying $5 to test it out doesn’t seem like that big of an ask, in my humble opinion.