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.
Have similiar issue. I switched to a different model, text-davinci-002 then it works, maybe the third model is overloaded? However, I donāt know, this might only be a specific problem for me.
Same thing for me, I am a paying user and when I make 3 requests in one minute, I get error 429.
I am building a tool that will be used by many users, I need a solution to this problemā¦
I make a lot of daily API calls, and have never had this problem except when I pulled 100s of text strings out of a DB and sent them to the embeddings API without a delay in the loop! That broken things fast, after a few iterations.
However, for all ānormalā (not in a fast loop) API call, I have never had this issue, ever.
My best guess is that there is some āstrangenessā going on with Cloudflare, based on some access / rate limiting criteria we are not aware of. It is also possible that OpenAI has been so busy that the have not updated their "work flow " to update Cloudflare rate limiting on a āper userā basis. However, I āthinkā (from all the posts here) the issue resides in Cloudflare.
You can see from this Cloudflare doc, that every user would have to match a criteria and the Cloudflare rate limiting rule updated / created:
Iām not a Cloudflare person (or a big fan of Cloudflare, TBH), but it does not seem ātrivialā to set up Cloudflare on a āper userā basis based on a OpenAI plan which is outside of the Cloudflare ecosystem.
It could easily be possible that the OpenAI staff is not aware of what must happen on the Clouldflare end of things to support their new paid plans?