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 讨论。"

相关推荐
golang学习记10 分钟前
GPT-5.1 正式发布:更智能、更拟人、更可靠——大模型进入「深度对话时代」
gpt
Dxy123931021614 分钟前
Python类入门:用“汽车工厂”理解面向对象编程
python
蓑雨春归15 分钟前
GPT-5.2在ARC-AGI-2上的能力跃升分析
gpt·agi
拉普拉斯妖10818 分钟前
DAY35 模型可视化与推理
python
无垠的广袤20 分钟前
【启明云端 WT9932S3-Nano 开发板】介绍、环境搭建、工程测试
python·单片机·嵌入式硬件
2301_7644413329 分钟前
PMC政策文本量化评估
python·算法·信息可视化
木土雨成小小测试员31 分钟前
Python测试开发之跨域请求
开发语言·python
闲人编程32 分钟前
静态文件处理与模板渲染深度指南
python·渲染·毕设·模板引擎·静态文件·codecapsule
deephub41 分钟前
PyCausalSim:基于模拟的因果发现的Python框架
开发语言·python·机器学习·因果发现
南_山无梅落1 小时前
8.Python3字典(dict):键值的增删改查_入门到进阶
python·算法