llm resource_error ai_generated true

openai.RateLimitError: 您已超出当前配额,请检查您的计划和账单详情。

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

ID: llm/embeddings-api-quota-exceeded

其他格式: JSON · Markdown 中文 · English
85%修复率
88%置信度
1证据数
2023-06-15首次发现

版本兼容性

版本状态引入弃用备注
openai>=1.0.0 active
openai==0.28.0 active

根因分析

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

English

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

generic

官方文档

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

解决方案

  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)

无效尝试

常见但无效的做法:

  1. 70% 失败

    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% 失败

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