OpenAI ChatGPT (GPT-3.5) API error 429: "You exceeded your current quota, please check your plan and billing details"

Question:

I’m making a Python script to use OpenAI via its API. However, I’m getting this error:

openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details

My script is the following:

#!/usr/bin/env python3.8
# -*- coding: utf-8 -*-

import openai
openai.api_key = "<My PAI Key>"

completion = openai.ChatCompletion.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "user", "content": "Tell the world about the ChatGPT API in the style of a pirate."}
  ]
)

print(completion.choices[0].message.content)

I’m declaring the shebang python3.8 because I’m using pyenv. I think it should work, since I did 0 API requests, so I’m assuming there’s an error in my code.

Asked By: Unix

||

Answers:

Your code looks fine, in fact I believe it’s an example they give on their website. The problem appears to be on OpenAI’s side. If you scroll all the way to the bottom, someone posted about this four days ago.

https://community.openai.com/t/rate-limit-error/14769/27

Some people said that if they waited for a while it started working, so maybe just hang tight.

Answered By: Brock Brown

New account (i.e., if you recently signed up)

As stated in the official OpenAI documentation:

TYPE OVERVIEW
RateLimitError Cause: You have hit your assigned rate limit.
Solution: Pace your requests. Read more in our rate limit guide.

Also, read more about Error Code 429 – You exceeded your current quota, please check your plan and billing details:

This error message indicates that you have hit your maximum monthly
spend (hard limit) for the API. This means that you have consumed all
the credits or units allocated to your plan and have reached the limit
of your billing cycle. This could happen for several reasons, such as:

  • You are using a high-volume or complex service that consumes a lot of credits or units per request.

  • You are using a large or diverse data set that requires a lot of requests to process.

  • Your limit is set too low for your organization’s usage.

Old account (i.e., if you signed up some time ago)

Either you used all your free tokens or 3 months have passed since you signed up.

Check your API usage in the usage dashboard.

For example, my free trial expires tomorrow and this is what I see right now in the usage dashboard:

enter image description here

As stated in the official OpenAI article:

What happens after I use my free tokens or the 3-months is up in the free trial?

To explore and experiment with the API, all new users get $5
worth of free tokens. These tokens expire after 3 months.

After the quota has passed you can choose to enter billing information
to upgrade to a paid plan and continue your use of the API on
pay-as-you-go basis. If no billing information is entered you will
still have login access, but will be unable to make any further API
requests.

Please see the pricing page for the latest information on
pay-as-you-go pricing.

Note: If you signed up earlier (e.g., in December 2022), you got $18 worth of free tokens.


EDIT

Is this your first and only OpenAI account? It seems like free credit is given based on phone number.

As explained on the official OpenAI forum by @SapphireFelineBytes:

You were on to something with the phone number.

I created an Open AI account in November and my $18 credits expired on
March 1st. So, like many of you here, I tried creating a new account
with a different email address, but same number. They gave me $0
credits.

I tried now with a different phone number and email. This time I got
$5 credits.

They’ve gotten stingy! Who lets credits expire without a way to
request more? And $18 to $5 is a big drop.

Answered By: Rok Benko
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.