llm resource_error ai_generated true

openai.RateLimitError: You exceeded your current quota, please check your plan and billing details.

ID: llm/embeddings-api-quota-exceeded

Also available as: JSON · Markdown · 中文
85%Fix Rate
88%Confidence
1Evidence
2023-06-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
openai>=1.0.0 active
openai==0.28.0 active

Root Cause

The API usage has exceeded the paid tier's token or request quota for the billing period, or the account has insufficient credits.

generic

中文

API使用量已超出当前付费层的令牌数或请求配额,或账户余额不足。

Official Documentation

https://platform.openai.com/docs/guides/error-codes/api-errors

Workarounds

  1. 90% success Check billing dashboard at https://platform.openai.com/account/billing and add funds or upgrade plan. Then monitor usage via API: import openai usage = openai.Usage.retrieve() print(usage)
    Check billing dashboard at https://platform.openai.com/account/billing and add funds or upgrade plan. Then monitor usage via API:
    import openai
    usage = openai.Usage.retrieve()
    print(usage)
  2. 80% success Implement a fallback to a different embedding model or provider when quota is exceeded: if 'quota' in str(e): model = 'text-embedding-ada-002' # Fallback to cheaper model response = openai.Embedding.create(input=text, model=model)
    Implement a fallback to a different embedding model or provider when quota is exceeded:
    if 'quota' in str(e):
        model = 'text-embedding-ada-002'  # Fallback to cheaper model
        response = openai.Embedding.create(input=text, model=model)

中文步骤

  1. 在https://platform.openai.com/account/billing检查账单仪表板并添加资金或升级套餐。然后通过API监控使用量:
    import openai
    usage = openai.Usage.retrieve()
    print(usage)
  2. 当超出配额时,实现回退到不同的嵌入模型或提供商:
    if 'quota' in str(e):
        model = 'text-embedding-ada-002'  # 回退到更便宜的模型
        response = openai.Embedding.create(input=text, model=model)

Dead Ends

Common approaches that don't work:

  1. 70% fail

    The error is a quota exhaustion, not a rate limit. Retrying will keep failing until the billing period resets or more credits are added.

  2. 50% fail

    The quota is based on total usage, not request size. Reducing batch size doesn't help if the total quota is exhausted.