# You exceeded your current quota error

**URL:** <https://community.openai.com/t/you-exceeded-your-current-quota-error/569790>\
**Category:** API\
**Tags:** gpt-3\
**Created:** [December 23, 2023, 5:33pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790 "2023-12-23T17:33:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![officialayo540](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/officialayo540/32/279112_2.png) [@officialayo540](https://community.openai.com/u/officialayo540)\
**Post date:** [December 23, 2023, 5:33pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/1 "2023-12-23T17:33:56Z")

</div>

I’m working on a project and decided to use the openai API alongside (FREE version), but on working with it on the backend of my code (NODEJS). I discovered that on requesting the API, it keeps telling me that, I’ve exceeded my current quota. but my usage doesn’t even read at all, I haven’t made any successful call to the API, my first API call threw that error and also subsequent ones as well.

here’s are the relevant code, maybe if someone could help out with what’s wrong

// config file

```auto
require('dotenv').config();
const OpenAI = require('openai');

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

module.exports = openai;

```

// openai controller

```auto
const openai = require('../config/openaiConfig');

const generateMnemonics = async (keyword) => {
  const mnemonics = await openai.chat.completions.create({
    messages: [
      {
        role: 'user',
        content: `mnemonic for ${keyword}.`,
      },
    ],
    model: 'gpt-3.5-turbo',
  });

  console.log('mnemonics', mnemonics);

  const data = mnemonics.data.choices[0].message;
  console.log(data);
  return data;
};

module.exports = { generateMnemonics };

```

// controller /endpoint

```auto
const getMnemonics = async (req, res) => {
  try {
    const mnemonics = await generateMnemonics('abate');
    res.status(200).json({ message: mnemonics });
  } catch (err) {
    console.log(err);
    res.status(500).json({ message: 'Something went wrong!' });
  }
};

```

there’s also a route file that on making a request to that API, calls this function, I personally don’t think I implemented anything wrong, but maybe I’m wrong.

Please I’d be glad if anyone could help suggest a fix to this as soon as possible, I do want to upgrade but I can’t now because I keep getting that error message.

---

<div class="post-metadata">

**Author:** ![VeitB](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/veitb/32/712987_2.png) [@VeitB](https://community.openai.com/u/VeitB)\
**Post date:** [December 23, 2023, 5:37pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/2 "2023-12-23T17:37:09Z")

</div>

Hi and welcome to the community!

The issue may not be with your code but with the way how free accounts are being rate limited

According to this page:

[https://platform.openai.com/docs/guides/rate-limits?context=tier-free](https://platform.openai.com/docs/guides/rate-limits?context=tier-free)

You get three calls per minute. A threshold that is easy to exceed.  
If you spend 1$ you will be upgraded to Tier 1 which is more friendly.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![officialayo540](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/officialayo540/32/279112_2.png) [@officialayo540](https://community.openai.com/u/officialayo540)\
**Post date:** [December 23, 2023, 5:42pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/3 "2023-12-23T17:42:11Z")

</div>

but the issue is I don’t know if upgrading I’d still come across this same issue.  
I mean I haven’t even made any request to the API successfully and keep getting that error message. Isn’t it supposed to be when someone makes 3 consecutive requests per minute that the error is supposed to be shown?  
I also attached my usage screenshot. still reads 0

 ![Screenshot 2023-12-23 184449](https://us1.discourse-cdn.com/openai1/original/4X/d/a/a/daa31d92ff8f0125134e83def187f24372901003.png)

---

<div class="post-metadata">

**Author:** ![VeitB](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/veitb/32/712987_2.png) [@VeitB](https://community.openai.com/u/VeitB)\
**Post date:** [December 23, 2023, 5:43pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/4 "2023-12-23T17:43:38Z")

</div>

Alright, then I suggest you try the most simple example from the quickstart.  
This should help you figure out your question.

[https://platform.openai.com/docs/quickstart?context=python](https://platform.openai.com/docs/quickstart?context=python)

---

<div class="post-metadata">

**Author:** ![officialayo540](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/officialayo540/32/279112_2.png) [@officialayo540](https://community.openai.com/u/officialayo540)\
**Post date:** [December 23, 2023, 5:54pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/5 "2023-12-23T17:54:11Z")

</div>

that’s the same documentation I used when starting initially.  
and I’m getting the same error message

---

<div class="post-metadata">

**Author:** ![PaulBellow](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/paulbellow/32/597962_2.png) [@PaulBellow](https://community.openai.com/u/PaulBellow)\
**Post date:** [December 23, 2023, 5:56pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/6 "2023-12-23T17:56:10Z")

</div>

Do you have current billing info (credit card) tied to the account with a balance?

---

<div class="post-metadata">

**Author:** ![officialayo540](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/officialayo540/32/279112_2.png) [@officialayo540](https://community.openai.com/u/officialayo540)\
**Post date:** [December 23, 2023, 6:04pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/7 "2023-12-23T18:04:40Z")

</div>

no, I haven’t added my card info to that account.

---

<div class="post-metadata">

**Author:** ![PaulBellow](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/paulbellow/32/597962_2.png) [@PaulBellow](https://community.openai.com/u/PaulBellow)\
**Post date:** [December 23, 2023, 6:12pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/8 "2023-12-23T18:12:23Z")

</div>

You’ll need to do that and have a bit of balance in your account. Try that…

---

<div class="post-metadata">

**Author:** ![VeitB](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/veitb/32/712987_2.png) [@VeitB](https://community.openai.com/u/VeitB)\
**Post date:** [December 23, 2023, 6:12pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/9 "2023-12-23T18:12:28Z")

</div>

Please try the following script

```auto
import openai

API_KEY = "sk-OJGpZ4...4zLcPtrB"

client = openai.OpenAI(api_key=API_KEY)

completion = client.chat.completions.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},
    {"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."}
  ]
)

print(completion.choices[0].message)

```

Make sure to adjust the API key.  
I don’t exactly follow how you could build a script like the one you originally posted, if you never were able to contact the API in the first place.  
Let’s find out what’s going on.

---

<div class="post-metadata">

**Author:** ![scharleswatson](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/scharleswatson/32/424054_2.png) [@scharleswatson](https://community.openai.com/u/scharleswatson)\
**Post date:** [December 23, 2023, 8:01pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/10 "2023-12-23T20:01:41Z")

</div>

The api used to be pay as you go, now it is prepay. So put $ in your account and it should respond as expected

---

<div class="post-metadata">

**Author:** ![officialayo540](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/officialayo540/32/279112_2.png) [@officialayo540](https://community.openai.com/u/officialayo540)\
**Post date:** [December 23, 2023, 9:21pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/11 "2023-12-23T21:21:38Z")

</div>

I used to think there are some free quota to use for free users to play around with.  
Or has that been scrapped out?

---

<div class="post-metadata">

**Author:** ![VeitB](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/veitb/32/712987_2.png) [@VeitB](https://community.openai.com/u/VeitB)\
**Post date:** [December 23, 2023, 9:49pm UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/12 "2023-12-23T21:49:32Z")

</div>

From what I can tell: there have been other free tier users with the rate limiting problem who then went ahead and got better rate limits after purchasing credits. But this means that you should be able to make API calls without buying credits and it’s your implementation that is causing the issue.

But I can’t tell for sure since I don’t have the possibility to create a free tier account and confirm this.

---

<div class="post-metadata">

**Author:** ![AlexKiselyov](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/alexkiselyov/32/147216_2.png) [@AlexKiselyov](https://community.openai.com/u/AlexKiselyov)\
**Post date:** [January 16, 2024, 2:34am UTC](https://community.openai.com/t/you-exceeded-your-current-quota-error/569790/13 "2024-01-16T02:34:48Z")

</div>

I can confirm that after purchasing a minimum amount of credit ($5 worth) API starts working. Note, however, that **a new token must be created** after the purchase, otherwise the same quota error will be returned.  
To me this looks like either a bug or a documentation defect: Settings/Limits shown non-zero figures both before and after a purchase 🤷‍♂️
