Error message "billing_hard_limit_reached" when curling https://api.openai.com/v1/images/generations

Hi all I have a free account for research purpose
I am generating images via curling
https://api.openai.com/v1/images/generations
e.g.:

curl https://api.openai.com/v1/images/generations \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "prompt": "a white siamese cat",
    "n": 1,
    "size": "1024x1024"
  }'

It was working fine on Friday morning but in the evening I start getting error:
StatusCodeError: 400 - {"error":{"code":"billing_hard_limit_reached","message":"Billing hard limit has been reached","param":null,"type":"invalid_request_error"}}

I just started using the API and I shouldn’t already reached credit limit, and I didn’t do more than 50 images per minutes.

I created another account and use a different API Key but I still get the above error.

Anyone could help me with this matter?

At the following is the full payload and response:

curl https://api.openai.com/v1/images/generations \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer sk-...................." \
  -d '{
    "prompt": "a white siamese cat",
    "n": 1,
    "size": "1024x1024"
  }'

{
  "error": {
    "code": "billing_hard_limit_reached",
    "message": "Billing hard limit has been reached",
    "param": null,
    "type": "invalid_request_error"
  }
}

Thank you.
Best regards,.

Hey @klosezhang, out of curiosity, have you checked your usage limits? There is a hard limit you can set there which mentions that once you surpass it, every subsequent request will get rejected

Thank you for the reply.
After investigation, it is confirmed that the free trail account is running out of free credit. Even I created another account later on, however, as the mobile number I use to create the account is the same, hence I didn’t get free credits for my 2nd account, hence the new API key generated for the 2nd account does not work neither.

You’ve used $0.00 out of the $18.00 total credit granted to you. i did not use any single , from start only i am getting the same result bad request

The free tier image gen limit is 3 per min for DE-3 and 5 per min for DE-2, not 50.

Account free trial credits expire after three months from account creation. That is even if you only created an account to use ChatGPT, and had never heard the word “API” until today.

For an account with expired trial credits (which would be everyone in this nine-month-old topic), you would need to purchase prepaid credits with a minimum purchase of $5 in order to use the OpenAI API.

Hi, I am a pay user. But still get the same message.
Here is my code:
client = OpenAI(
api_key = “sk-xxxxxxxxxxxxxxxxx”
)

response = client.images.generate(
model=“dall-e-3”,
prompt=“a white siamese cat”,
size=“1024x1024”,
quality=“standard”,
n=1,
)

image_url = response.data[0].url

If the message you receive is exactly “billing hard limit”, that error is from the monthly budget limit that you set for yourself on your own account.

Here’s where you can view the setting and your spending, and change the threshold.

https://platform.openai.com/account/limits

1 Like

Thanks.
Yesterday, all models include chat, tts, asr and dall-e API are working. And today they are all show “billing hard limit” mean all models use the same budget limitation. Am I right?

1 Like

Yes, that is the main setting for your account. Your usage for just a few days this month is what you set the monthly hard limit to. You limit your own account with that setting.

Hi Sir:

I just renewed my ChatGPT yesterday. I call the API start from today.

Why I still get the error as:

Exception has occurred: RateLimitError

ChatGPT subscription does not fund or enable API. Nor is it necessary.

They use completely separate billing systems, where you pay for the amount of language data transferred on API.

Read the full message of an error; is it along the lines of “check your plan and billing”, meaning you don’t have any prepaid credits in your API account?