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

相关推荐
麻雀无能为力23 分钟前
python自学笔记14 NumPy 线性代数
笔记·python·numpy
大学生毕业题目1 小时前
毕业项目推荐:28-基于yolov8/yolov5/yolo11的电塔危险物品检测识别系统(Python+卷积神经网络)
人工智能·python·yolo·cnn·pyqt·电塔·危险物品
程序猿小D3 小时前
【完整源码+数据集+部署教程】脑部CT图像分割系统源码和数据集:改进yolo11-CSwinTransformer
python·yolo·计算机视觉·数据集·yolo11·脑部ct图像分割
max5006003 小时前
北京大学MuMo多模态肿瘤分类模型复现与迁移学习
人工智能·python·机器学习·分类·数据挖掘·迁移学习
修一呀3 小时前
[后端快速搭建]基于 Django+DeepSeek API 快速搭建智能问答后端
后端·python·django
WSSWWWSSW4 小时前
Seaborn数据可视化实战:Seaborn数据可视化实战入门
python·信息可视化·数据挖掘·数据分析·matplotlib·seaborn
小石4 小时前
Python 装饰器核心知识点:无参装饰器构建、带参装饰器扩展及函数与类实现差异
python
巴厘猫5 小时前
从 Manim 中提取表格 / 坐标系并转 GIF:实用方案与核心代码
python·音视频开发
老歌老听老掉牙5 小时前
Pandas DataFrame 列数操作完全指南
python·pandas
数据智能老司机5 小时前
Python 实战遗传算法——遗传算法导论
python·算法·机器学习