I am trying to make a request to the openai API with the following code in express nodeJS:
import { Configuration, OpenAIApi } from "openai";
const configuration = new Configuration({
organization: "org-Fn2EqsTpiUCTKb8m61wr6H8m",
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
});
const openai = new OpenAIApi(configuration);
async function callApi() {
const response = await openai.createCompletion({
model: "text-davinci-003",
prompt: "Say this is a test",
max_tokens: 3000,
temperature: 0,
});
console.log(response.data.choices[0].text);
}
callApi();
The problem is that I keep getting error 429 Too many requests.
Here some more information:
- The API key is correct.
- When I go to my openai account > view API KEY: it shows that the key was never used so I have never been able to make a call. So how is it possibile that I'm getting error Too many requests?
- I have already tried to implement exponential backoff in the function, but it didn't work.
Rate limit reached for default-text-davinci-002 in ...
). Getting the error sometimes, even though I'm way below my limits. – Varion429 Too Many Requests
on first request. The API error persists also if I try again... I am below the rate limit (obviously) and I am below the quota (just checked in the dashboard). – Ideography