Open AI Api Error : Billing Hard Limit Has Been Reached

Open AI Api Error :  Billing Hard Limit Has Been Reached

Problem

Whenever you have any billing issue with your openai account you might see that your api keys are no longer working. So, you go and check if there are any pending invoices and pay them. But even after paying the invoices, you might still keeping getting the errors and this is how you can resolve it.

This error mostly occurs mostly after following error when you try to use the Open AI API:

Your account is not active, please check your billing details on our website.

You can resolve above error by paying all of your Open AI pending Invoices, it doesn't matter if it's a minimal amount. But after paying the invoice, you may still get the error Billing Hard Limit Has Been Reached.

This is while calling the Open AI API from code, e.g

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

Solution

You need to change the API key in your code. You can get the new API key from the Open AI dashboard. I am not sure why this happens, but changing the API key resolves the issue. Seems like the API key gets blocked forever after the billing issue and you need to get a new one.

Open AI gives a pretty good time to pay your old invoices but when it's time to pay, you should pay them as soon as possible to avoid any issues with the API.

Back To All Blogs