Getting 429 error, while I still have credit and org/project settings seem to be fine

Hi, Community,

I’m getting this error:
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’}}

While checking my Billing/Overview, I can see the balance is $59.99.

Then I checked the default organization is “home”; under “home” i have project “health consultant”; under “health consultant”, i have the API key.

The whole chain seems to be fine, but maybe I still missed something? Please share if you can find any.

While, I didn’t understand the model list well.
Project Allowed models
gpt-4o
gpt-4-turbo
dall-e-3
gpt-3.5-turbo-0125
gpt-4
Using client.models.list(), I get a totally different list.
Please share any ideas.

Thanks.

My code:
import os
from openai import OpenAI
from config.config import Config

client = OpenAI(
# organization=Config.OPENAI_ORGANIZATION_ID,
api_key=Config.OPENAI_API_KEY, # This is the default and can be omitted
)
# Test API Key
response = client.models.list()
print("API Key Verified. Model list:")
for model in response:
print(f"- {model.id}")
print("client.organization", client.organization)
print("client.project", client.project)

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

The result:
python test.py
API Key Verified. Model list:

  • text-embedding-3-small
  • dall-e-2
  • o1-mini-2024-09-12
  • o1-mini
  • gpt-3.5-turbo-instruct
  • babbage-002
  • davinci-002
  • whisper-1
  • dall-e-3
  • text-embedding-ada-002
  • gpt-3.5-turbo-16k
  • omni-moderation-latest
  • omni-moderation-2024-09-26
  • tts-1-hd-1106
  • gpt-3.5-turbo
  • gpt-3.5-turbo-0125
  • o1-preview
  • o1-preview-2024-09-12
  • tts-1-hd
  • gpt-4o-mini-2024-07-18
  • gpt-4o-mini
  • gpt-3.5-turbo-1106
  • tts-1
  • tts-1-1106
  • gpt-3.5-turbo-instruct-0914
  • text-embedding-3-large
    client.organization None
    client.project None
    Traceback (most recent call last):

    File “/Users/dd/.virtualenvs/openai/lib/python3.12/site-packages/openai/_base_client.py”, line 1061, 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’}}

Go to limits for the entire organization. Set a new monthly budget above your current spend. Save.

Thanks.
just changed monthly budget Alert from 50 to 80, and budget limit from 120 to 110.
But it didn’t help.

the current limit and usage.


So have you EVER used the API? Or have you had all of one cent of usage? Brand new?

Have you waited up to 24 hours for OpenAI to be as slow as they have in the past at some times in activating spending on an account?

There were some initial payments made in the past two or three weeks reported that didn’t unlock an account at all, and it took another minimum payment to fix the issue and provision spending, which can be faster than sending a “help” message through the platform site.

Thanks, J,

I registered about two years ago, but the API never worked for me. Two days ago, I encountered a scenario where using the API made a lot of sense, so I decided to try again, unfortunately, it still doesn’t work.

The 1 cent charge happened while using the playground, where things worked fine.

I wasn’t aware that it takes time for payments to take effect. Thanks for clarifying! I’ve made two payments, so I’ll wait a bit and try again. It would be helpful if this was highlighted in the official documentation to save users from spending unnecessary time troubleshooting their environment and settings.

I appreciate your help! I’ll wait a week and try again. That said, this process feels a bit outdated, like something from the pre-computer era when everything had to be done manually.

It definitely shouldn’t take a week to pay and use the API - typical is just minutes to sometimes hours. It does take generating an API key, verifying a mobile phone number at some point, which was part of initial account creation two years ago, and filling in billing details that match the payment method was also a previous hurdle.

Projects is a new paradigm - in default project, generate a new API key, and don’t touch the “all access” defaults there. See if you can interact in the playground and then by API call then. By now, I’d send a message through “help” for API account issues in the platform site.

1 Like

I’ve identified the root cause.

A very old API key was saved in my .zshrc file a long time ago. The OpenAI client always reads the value from the environment variable, regardless of explicitly setting the key in the code like this:

client = OpenAI(
api_key=Config.OPENAI_API_KEY, 
)

This approach didn’t work because the client prioritized the environment variable.

The solution was to update the API key in the .zshrc file.