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.

1 Like

i’m getting same issue what i need to do can you help me regarding this i’m new into it

also check this ss also here i have already set the limit.

You’re looking at account limits.

Where you should be looking is in billing to see if you ran your account out of credits. :slight_smile:

sry but what specifically i should look in billing section? can you just give me the example through screen shot

Sure: you log in to the platform site as you are.

Follow this link instead of me explaining how to get there:

https://platform.openai.com/settings/organization/billing/overview

See the balance at $0.00 (or less). It time to fill back up.

This old topic of reporting “429-check your billing” was resolved by identification of an old API key being used. For you to continue on it in a way that was on topic means you’d be able to answer the part about “…while I still have credit”.

1 Like

for above quote i’m not able to understand what you are saying and i have already have balance in billing section as i took his openai usage tier one subscription.

and also one silly question ,how we can identify if you are using the old api key or new api key?

You have visited the linked page?

You do have a positive balance remaining?

I can see in the screenshots that you used $4.23 this month, and your continuous use since the first day of the month means there was likely also usage in the prior month not seen.

You must have a positive balance to pay for the actual usage of data by models.

If you put in $5.00 total only once, for example, made $4.23 usage and there was also usage in the prior month, that leads me to the high possibility that you exhausted your available funds. Your “gift card” is empty.

You bumped an old forum topic likely having nothing to do with your actual issue except for the number 429.

so what i need to do now ?

This is what an account balance that can pay for API calls looks like.

If it is $0.00, you can’t pay for new API calls because you are out of money.

my credit balance is almost $120.

It is not going to be $120. $120 is monthly spend limit common to all starter accounts, not how much you prepaid. It is not possible for a tier-1 account to add more than $100.

I gave a web link to the Billing Overview.

Click the link.

See the image exactly like mine, and the amount below “Credit balance”.

See your balance remaining from what you prepaid.

Share the page if you are confused.

1 Like

thank you ! i add some credit balance and it works :smiley: