Kar*_*ran 31 node.js express http-status-code-429 openai-api
我正在尝试使用 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。
这里有更多信息:
小智 32
我遇到过同样的问题。原因是我在将 OpenAI 帐户转换为付费帐户(添加信用卡)之前创建了 API 密钥。如果您只升级也没关系,您还需要完全创建一个新的 api 密钥。
添加信用卡后,我创建了另一个 API 密钥,效果很好!
小智 24
如果您在 4 月 1 日之后收到相同的错误 (429),则意味着您的免费试用 18 美元(在 4 月之前注册的所有帐户中)已过期,即使您一次都没有使用过 api 密钥。
在您的 API 使用页面中,您会发现如下所示:
GRANT # CREDIT GRANTED EXPIRES (UTC)
Grant 1 $18.00 Expired 2023-04-01
Run Code Online (Sandbox Code Playgroud)
好消息是您仍然可以使用官方网络聊天页面。
小智 8
不适合OP,但就我而言,问题是我需要向方法提供我的组织ID,Configuration如下所示:
import { Configuration } from "openai";
const configuration = new Configuration({
organization: "org-xxxx",
apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
});
Run Code Online (Sandbox Code Playgroud)
您可以从此页面获取组织 ID: https: //platform.openai.com/account/org-settings
| 归档时间: |
|
| 查看次数: |
36240 次 |
| 最近记录: |