gpt4 book ai didi

node.js - OpenAI API 给出错误 : 429 Too Many Requests

转载 作者:行者123 更新时间:2023-12-02 05:46:23 25 4
gpt4 key购买 nike

我正在尝试使用 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();

问题是我不断收到错误 429 请求过多。

这里有更多信息:

  • API key 正确。
  • 当我转到我的 openai 帐户 > 查看 API key 时:它显示该 key 从未使用过,所以我一直无法调用电话。那么,我怎么可能会收到请求过多的错误?
  • 我已经尝试在函数中实现指数退避,但没有成功。

最佳答案

答案在您收到的错误中。

错误 429 Too Many Requests 表示您已经超出了免费的 18 美元 API 积分。您可以在 official website 上支付更多费用.

您的 key 可能是正确的,但在您尝试发出请求时未被使用。仔细检查您在代码中使用的 key 是否正确。

关于node.js - OpenAI API 给出错误 : 429 Too Many Requests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75041580/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com