Getting RateLimitError while implementing openai GPT with Python

题意:"在使用 Python 实现 OpenAI GPT 时遇到 RateLimitError 错误。"

问题背景:

I have started to implement openai gpt model in python. I have to send a single request in which I am getting RateLimitError.

"我开始在 Python 中实现 OpenAI GPT 模型。发送单个请求时遇到了 RateLimitError 错误。"

My code looks like this 我的代码类似如下

python 复制代码
import openai

key = '<SECRET-KEY>'
openai.api_key = key
model_engine = 'text-ada-001'
prompt = 'Hi, How are you today?'
completion = openai.Completion.create(engine=model_engine, prompt=prompt, max_token=2048, n=1, stop=None, temprature=0.5)
print(completion.choices)

This is what error I am getting 我得到的错误信息如下

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

So, How do I do development without getting this error? I have checked the doc they provide a free version with limitations but this is the initial stage I have sent only 5-6 requests in an hour.

"那么,我该如何在不出现此错误的情况下进行开发?我查看了文档,他们提供了一个有限制的免费版本,但这是初始阶段,我每小时只发送了 5-6 个请求。"

Thanks advance for your help. "提前感谢您的帮助。"

问题解决:

Later versions (>= 1.0.0) of the openai Python API include functionality to automatically retry requests. See GitHub discussion.

"较新版本(>= 1.0.0)的 OpenAI Python API 包含自动重试请求的功能。请参见 GitHub 讨论。"

相关推荐
Nina_7171 分钟前
DAY 44 训练
python
Rose 使者17 分钟前
今日实时汇率查询接口如何用Python实现调用?
python·api·汇率查询
惜鸟20 分钟前
Pydantic 的 BaseSettings 配置解析
后端·python
MYH51629 分钟前
拉力测试cuda pytorch 把 4070显卡拉满
人工智能·pytorch·python
某人辛木34 分钟前
基于tensorflow实现的猫狗识别
人工智能·python·tensorflow
大白爱琴36 分钟前
使用python进行图像处理—图像变换(6)
图像处理·人工智能·python
月忆3641 小时前
等待组(waitgroup)
前端·爬虫·python
一个何包蛋!!1 小时前
相关类相关的可视化图像总结
开发语言·python·数据可视化
技术便签1 小时前
第一篇:Agent2Agent (A2A) 协议——协作式人工智能的黎明
人工智能·python·ai编程·agi·多智能体·智能体·adk
love530love1 小时前
教程:PyCharm 中搭建多级隔离的 Poetry 环境(从 Anaconda 到项目专属.venv)
开发语言·ide·人工智能·windows·python·pycharm