You exceeded your current quota error

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

const OpenAI = require('openai');

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

module.exports = openai;

// openai controller

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

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

  console.log('mnemonics', mnemonics);

  const data =[0].message;
  return data;

module.exports = { generateMnemonics };

// controller /endpoint

const getMnemonics = async (req, res) => {
  try {
    const mnemonics = await generateMnemonics('abate');
    res.status(200).json({ message: mnemonics });
  } catch (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.

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:

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!

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

1 Like

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

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

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

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

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

1 Like

Please try the following script

import openai

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

client = openai.OpenAI(api_key=API_KEY)

completion =
    {"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."}


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.

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

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

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.

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 :man_shrugging:

1 Like