I’m running into a weird issue with the OpenAI API in my Node.js application. Every time I try to make a request, I get a 429 error saying too many requests, but my API key shows zero usage in the dashboard.
import { Configuration, OpenAIApi } from "openai";
const config = new Configuration({
organization: "org-ABC123DEF456GHI789JKL012",
apiKey: "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
});
const client = new OpenAIApi(config);
async function makeRequest() {
try {
const result = await client.createCompletion({
model: "text-davinci-003",
prompt: "Hello world test",
max_tokens: 2000,
temperature: 0.5,
});
console.log(result.data.choices[0].text);
} catch (error) {
console.error(error);
}
}
makeRequest();
What I’ve checked so far:
- API key is definitely valid
- Dashboard shows the key has never been used
- Already tried adding retry logic with delays
Anyone know why this might be happening when I haven’t even made successful requests yet?