gpt4 book ai didi

python - OpenAI ChatGPT (GPT-3.5) API 错误 429 : "You exceeded your current quota, please check your plan and billing details"

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

我正在制作一个 Python 脚本以通过其 API 使用 OpenAI。但是,我收到此错误:

openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details

我的脚本如下:

#!/usr/bin/env python3.8
# -*- coding: utf-8 -*-

import openai
openai.api_key = "<My PAI Key>"

completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": "Tell the world about the ChatGPT API in the style of a pirate."}
]
)

print(completion.choices[0].message.content)

我宣布 Shebang python3.8 ,因为我正在使用 pyenv 。我认为它应该可以工作,因为我执行了 0 个 API 请求,所以我假设我的代码中有错误。

最佳答案

TL;DR:您需要升级到付费计划。设置付费帐户,添加信用卡或借记卡,并生成新的 API key (如果您的旧 API key 是在升级前生成的)。升级到付费计划后,可能需要 10 分钟左右,付费帐户才会生效并且错误会消失。

问题

正如官方所说OpenAI documentation :

<表类=“s-表”><标题>类型概述 <正文>速率限制错误 原因:您已达到分配的速率限制。
解决方案:调整您的请求的节奏。在我们的 rate limit guide 中了解更多信息.

此外,请阅读有关 Error Code 429 - You exceeded your current quota, please check your plan and billing details 的更多信息:

This (i.e., 429) error message indicates that you have hit your maximum monthlyspend (hard limit) for the API. This means that you have consumed allthe credits or units allocated to your plan and have reached the limitof your billing cycle. This could happen for several reasons, such as:

  • You are using a high-volume or complex service that consumes a lot of credits or units per request.

  • You are using a large or diverse data set that requires a lot of requests to process.

  • Your limit is set too low for your organization’s usage.


您之前注册过吗?

您收到错误429因为您要么用完所有免费代币,要么自注册以来已经过去了 3 个月。

正如官方所说OpenAI article :

To explore and experiment with the API, all new users get $5worth of free tokens. These tokens expire after 3 months.

After the quota has passed you can choose to enter billing informationto upgrade to a paid plan and continue your use of the API onpay-as-you-go basis. If no billing information is entered you willstill have login access, but will be unable to make any further APIrequests.

Please see the pricing page for the latest information onpay-as-you-go pricing.

注意:如果您较早注册(例如,在 2022 年 12 月),您将获得值(value) 18 美元的免费代币。

usage dashboard 中检查您的 API 使用情况.

例如,我的免费试用明天到期,这是我现在在使用仪表板中看到的内容:

Before expiration

这是我的仪表板在过期后的样子:

After expiration

如果我在免费试用期结束后运行一个简单的脚本,则会收到以下错误:

openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.


您是否创建了第二个 OpenAI 帐户?

您收到错误429因为您使用相同的电话号码创建了第二个 OpenAI 帐户。似乎免费信用是根据电话号码提供的。

正如官方解释的OpenAI forum by @SapphireFelineBytes :

I created an Open AI account in November and my $18 credits expired onMarch 1st. So, like many of you here, I tried creating a new accountwith a different email address, but same number. They gave me $0credits.

I tried now with a different phone number and email. This time I got$5 credits.

更新:

已确认根据电话号码给予免费积分,官方说明OpenAI forum by @logankilpatrick :

Also note, you only get free credits for the first account associatedwith your phone number. Subsequent accounts are not granted free credits.

解决方案

尝试执行以下操作:

  1. Set up paid account .
  2. Add a credit or debit card .
  3. Generate a new API key如果您的旧 API key 是在升级到付费套餐之前生成的。

当您升级到付费计划时,不要指望错误会立即消失,正如@dcferreira 在上面的评论中提到的那样。升级后可能需要几分钟时间错误才会消失。

更新:

在下面的评论中,@JoeMornin 确认他的付费帐户需要 10 分钟才能激活。与此同时,他得到了以下错误:

You've reached your usage limit. See your usage dashboard and billing settings for more details. If you have further questions, please contact us through our help center at help.openai.com.

关于python - OpenAI ChatGPT (GPT-3.5) API 错误 429 : "You exceeded your current quota, please check your plan and billing details",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77020970/

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