OpenAI API giving error: 429 Too Many Requests

avatar
作者
猴君
阅读量:0

题意:OpenAI API 返回错误:429 请求过多

问题背景:

I am trying to make a request to the openai API with the following code in express nodeJS:

我正在尝试使用以下 Express Node.js 代码向 OpenAI API 发送请求:

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.

问题是,我一直收到错误 429 请求过多。

Here some more information:        这里有更多的信息:

  • The API key is correct.        API key是正确的
  • 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?

当我进入我的 OpenAI 账户 > 查看 API 密钥时:它显示该密钥从未被使用过,所以我从未能够发起任何调用。那么,我怎么可能收到‘请求过多’的错误呢?

  • I have already tried to implement exponential backoff in the function, but it didn't work.

我已经尝试在该函数中实现指数退避(exponential backoff),但它没有起作用。

问题解决:

I had the same issue. The reason was that I created my API key BEFORE converting my OpenAI account to paid (adding credit card). Doesn't matter if you only upgrade, you also need to create a new api key entirely.

我也遇到了同样的问题。原因是在我将 OpenAI 账户转换为付费账户(添加信用卡)之前创建了我的 API 密钥。无论你是否只是升级了账户,你都需要完全创建一个新的 API 密钥。

I created another API key AFTER I added my credit card and it worked fine!

在我添加信用卡之后,我创建了另一个 API 密钥,并且它工作正常!

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!