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

相关推荐
云和数据.ChenGuang9 分钟前
Python 闭包详解:从原理到实战
linux·开发语言·人工智能·python·kubernetes
我命由我123451 小时前
Python 实用操作 - 文件操作(打开与关闭文件、读取文件、文件写入)
java·开发语言·前端·javascript·数据库·python·java-ee
青少儿编程课堂2 小时前
蓝桥杯·全国青少年信息素养大赛·电子学会Python/C++考级:倍增法求最近公共祖先LCA解析
c++·python·算法·bfs·信息学竞赛
atwednesday2 小时前
一文理解python中的task,协程,woker
python
用户0332126663672 小时前
使用 Python 在 Excel 中添加与删除筛选器
python·excel
1M553 小时前
AI应用后端工程(03):回答输出一半就断了:AI 流式接口如何定义成功与失败?
python·面试·职场和发展·计算机专业·agent开发
AI 编程助手GPT3 小时前
GPT 排的日志时间线差一小时?用 zoneinfo 复现夏令时回拨
人工智能·python·gpt
Thanks_ks4 小时前
【第 003 讲】全面认识 Python:语言起源与设计哲学 | 行业地位与流行趋势 | 技术优势与应用领域 | 技术边界与工程局限
人工智能·python·数据分析·编程语言·python 入门·web 开发·python 之禅
用户790860057264 小时前
给 AI 装上耳朵:离线语音识别与唤醒,国内环境踩坑实录
python
用户790860057264 小时前
我让 AI 自己上了趟网:browser-use 的三个致命坑和 CDP 混合方案
python