why am i getting RateLimitError? #361
-
|
Hi! openAI, Today I tried first time Here's the traceback |
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