I’m integrating OpenAI’s GPT API using Node.js. My app runs fine for a while, but then randomly throws:

Error: 429 - You exceeded your current quota, please check your plan and billing details.

Even with very low traffic (1–2 requests/min).

Here’s my sample code:

import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

async function ask(question) {
  const res = await client.chat.completions.create({
    model: "gpt-4o-mini",
    messages: [{ role: "user", content: question }]
  });
  console.log(res.choices[0].message.content);
}
ask("Hello, world!");

Questions:

  1. What causes random 429 errors even under low usage?

  2. Should I add retry logic or a delay between requests?

  3. Is there a way to check my actual request usage via API?

1 Reply 1

maybe it is with your tier. for instance I am on Usage tier 1, where I think I can make request 500/m. Check your tier

then, if you want, you can add logics.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.