429 Max Quota issue when only 35% of Quota is used

I am having an issue in which I get a 429 error saying that the Max Quota was exceeded but then I check the billing in the account that I am using and I have only used 35% of the total billing amount.

I checked my API Key to make sure I had the correct one and I do. I do not know why I am getting this error.

Edit:
My code is pretty simple. And it’s been working until yesterday (3-26-2024) where it started giving the errors I mentioned.

def call_ai(system, user, model='gpt-4', max_tokens=256):
    client = OpenAI(api_key = os.getenv('OPENAI_API_KEY'))

    max_retries = 5
    retry_delay = 2
    factor = 5
    for i in range(max_retries):
        try:
            response = client.chat.completions.create(
                model=model,
                messages=[
                    {
                        "role": "system",
                        "content": system
                    },
                    {
                        "role": "user",
                        "content": user
                    }
                ],
                temperature=0.3,
                max_tokens=max_tokens,
                top_p=1,
                frequency_penalty=0,
                presence_penalty=0
            )
            answer = response.choices[0].message.content
            # answer = response["choices"][0]["message"]["content"]
            return answer

        except Exception as e:
            print(f"Attempt {i+1} failed with error: {e}")
            error_msg = str(e)
            
            # Check if the error message contains the rate limit text
            if "Rate limit reached for" in error_msg:
                print("Rate limit reached, sleeping for 2 minutes...")
                time.sleep(120)
            elif i < max_retries - 1:
                time.sleep(retry_delay)
                retry_delay *= factor

def main():
    system = "You are a Math Expert "
    user = 'What is 1092398423 + 3920482948'
    response = ai.call_ai(system, user,"gpt-4-turbo-preview", max_tokens=256)
   print(response)
3 Likes

I also just started receiving this error. It showed my balance as negative for some reason. I added credits to make it positive, but I’m still seeing this error. Please help!

1 Like

I am also getting a 429 error with the embedding model. I have been using it in a production app for some time now but started getting this error yesterday. I am nowhere close to my total usage limits.

What’s strange is that calls to completion models such as gpt-3.5-turbo or gpt-4 are working as expected.

For me both the GPT-3-Turbo and GPT-4-Turbo-Preview are not working. It’s odd that it says that I’ve reached the quota even though I have not. Maybe an issue on their end?

I think so. The fact that it suddenly caused certain features of my app to break down - ones I have not modified for some time now. I even created a new Openai account to test and the error still remains for me although only for the embedding model.

I hope others can confirm if they are facing this error too.

Same 429 error. Has anyone solved this?

It’s not affecting everyone all the time, whatever’s going on.

I ran forty 600-token calls to text-embedding-3-small, and all were performed. A script that finds how undeterministic models are:

Number of unique embeddings: 5