why am i getting RateLimitError? #361
-
|
Hi! openAI, Today I tried first time Here's the traceback Traceback (most recent call last):
File "F:\botenv\lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "F:\kyubi\kyubi.py", line 41, in on_message
response = generate_response(message)
File "F:\kyubi\kyubi.py", line 17, in generate_response
response = openai.Completion.create(
File "F:\botenv\lib\site-packages\openai\api_resources\completion.py", line 25, in create
return super().create(*args, **kwargs)
File "F:\botenv\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "F:\botenv\lib\site-packages\openai\api_requestor.py", line 226, in request
resp, got_stream = self._interpret_response(result, stream)
File "F:\botenv\lib\site-packages\openai\api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "F:\botenv\lib\site-packages\openai\api_requestor.py", line 682, in _interpret_response_line
raise self.handle_error_response(
openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Hi @elamandeep! This repo is not monitored for support issues and is only for openai-python issues and bugs. Please reach out to support at help.openai.com and then shoud be able to help resolve your issue |
Beta Was this translation helpful? Give feedback.
-
|
RateLimitError is common! At RevolutionAI (https://revolutionai.io) we handle this daily. Quick fixes:
from tenacity import retry, wait_exponential, stop_after_attempt
@retry(wait=wait_exponential(min=1, max=60), stop=stop_after_attempt(5))
async def call_api(prompt):
return await client.chat.completions.create(...)
import asyncio
semaphore = asyncio.Semaphore(10) # Max concurrent
async def limited_call(prompt):
async with semaphore:
return await client.chat.completions.create(...)
curl https://api.openai.com/v1/rate_limits \
-H "Authorization: Bearer $OPENAI_API_KEY"Common causes:
Solution: Request limit increase or use LiteLLM for automatic retries! |
Beta Was this translation helpful? Give feedback.
Hi @elamandeep! This repo is not monitored for support issues and is only for openai-python issues and bugs. Please reach out to support at help.openai.com and then shoud be able to help resolve your issue