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

相关推荐
满怀冰雪5 小时前
06-自动微分入门:用 Paddle 计算梯度
人工智能·python·深度学习·paddle
xlrqx11 小时前
家电清洗培训课程类别、培训方式及费用情况究竟有哪些
大数据·python
lbb 小魔仙11 小时前
VS Code Python 高级调试技巧:从入门到精通
开发语言·python
lzqrzpt12 小时前
LED驱动电源行业品牌格局与技术差异深度总结
python·单片机·嵌入式硬件
李可以量化12 小时前
PTrade 策略入门:before_trading_start 函数详解(上)—— 盘前准备逻辑全指南
python
大海变好AI12 小时前
AIGC分层推理落地能否串联多工具完成自动化闭环
人工智能·python·自动化·aigc
小白说大模型12 小时前
从向量嵌入到复杂 Agent:LLM、LangChain、LangGraph 完整科普
java·开发语言·人工智能·gpt·深度学习·langchain
二宝哥13 小时前
14.Python模块与包完全指南:从定义到实战
python
三声三视13 小时前
交互式用够了?用 Agent SDK 把 Claude 塞进 Python Web 服务
人工智能·python·ai·aigc·ai编程
zhanghaha131413 小时前
Python语言基础:4_数据类型转换
java·前端·python