小编Kar*_*ran的帖子

OpenAI API 给出错误:429 请求过多

我正在尝试使用 Express NodeJS 中的以下代码向 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();
Run Code Online (Sandbox Code Playgroud)

问题是我不断收到错误 429 Too much requests。

这里有更多信息:

  • API 密钥正确。
  • 当我进入我的 openai 帐户 > 查看 API KEY 时:它显示该密钥从未使用过,因此我从未能够拨打电话。那么我怎么可能收到错误 Too much requests 呢?
  • 我已经尝试在函数中实现指数退避,但没有成功。

node.js express http-status-code-429 openai-api

31
推荐指数
4
解决办法
4万
查看次数