返回 Discover
Field DispatchStack Overflow2 · 2026-06-01

OpenAI API error 429: "You exceeded your current quota, please check your plan and billing details"

Tags
pythonpromptopenai-apicompletionchatgpt-api
Score
185
Answers
5
Views
486,307
Answered
Yes
Accepted
Yes
痛点分析发布于 2026/05/31

痛点为 AI 基于上游原始证据的初步提炼;未包含额外中国市场检索。

痛点

用户在编写Python脚本调用OpenAI API时,遇到429配额超限错误,导致脚本无法执行。用户明确表示“did 0 API requests”,说明问题并非实际使用超限,而是账户的免费额度已耗尽或过期。现有流程中,用户需要手动检查账单、升级付费计划、重新生成API密钥,且升级后需等待10分钟才能生效。这种不透明的配额管理和延迟生效机制,直接中断了开发者的工作流,造成时间浪费和调试困难。用户可能因此被迫中断开发进度,转向寻找替代方案或临时规避措施。

§ Dossier

Stack Overflow question

I'm making a Python script to use OpenAI via its API. However, I'm getting this error: openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details My script is the following: #!/usr/bin/env python3.8 # -*- coding: utf-8 -*- import openai openai.api_key = " " completion = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "user", "content": "Tell the world about the ChatGPT API in the style of a pirate."} ] ) print(completion.choices[0].message.content) I'm declaring the shebang python3.8 , because I'm using pyenv . I think it should work, since I did 0 API requests, so I'm assuming there's an error in my code.

§ Dossier

Question details

View count
486,307
Answer count
5
Last activity
2025/01/10
§ Dossier

Answers

TL;DR: You need to upgrade to a paid plan. Set up a paid account, add a credit or debit card, and generate a new API key if your old one was generated before the upgrade. It might take 10 minutes or so after you upgrade to a paid plan before the paid account becomes active and the error disappears. Problem As stated in the official OpenAI documentation : TYPE OVERVIEW RateLimitError Cause: You have hit your assigned rate limit. Solution: Pace your requests. Read more in our rate limit guide . Also, read more about Error Code 429 - You exceeded your current quota, please check your plan and billing details : This (i.e., 429 ) error message indicates that you have hit your maximum monthly spend (hard limit) for the API. This means that you have consumed all the credits or units allocated to your plan and have reached the limit of your billing cycle. This could happen for several reasons, such as: You are using a high-volume or complex service that consumes a lot of credits or units per request. You are using a large or diverse data set that requires a lot of requests to process. Your limit is set too low for your organization’s usage. Did you sign up some time ago? You're getting error 429 because either you used all your free tokens or 3 months have passed since you signed up. As stated in the official OpenAI article : To explore and experiment with the API, all new users get $5 worth of free tokens. These tokens expire after 3 months. After the quota has passed you can choose to enter billing information to upgrade to a paid plan and continue your use of the API on pay-as-you-go basis. If no billing information is entered you will still have login access, but will be unable to make any further API requests. Please see the pricing page for the latest information on pay-as-you-go pricing. Note: If you signed up earlier (e.g., in December 2022), you got $18 worth of free tokens. Check your API usage in the usage dashboard . For example, my free trial expires tomorrow and this is what I see right now in the usage dashboard: This is how my dashboard looks after expiration: If I run a simple script after my free trial has expired, I get the following error: openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details. Did you create your second OpenAI account? You're getting error 429 because you created a second OpenAI account with the same phone number. It seems like free credit is given based on phone numbers. As explained on the official OpenAI forum by @SapphireFelineBytes : I created an Open AI account in November and my $18 credits expired on March 1st. So, like many of you here, I tried creating a new account with a different email address, but same number. They gave me $0 credits. I tried now with a different phone number and email. This time I got $5 credits. It's confirmed that free credit is given based on phone numbers, as explained on the official OpenAI forum by @logankilpatrick : Also note, you only get free credits for the first account associated with your phone number. Subsequent accounts are not granted free credits. Solution Try to do the following: Set up paid account . Add a credit or debit card . Generate a new API key if your old API key was generated before you upgraded to the paid plan. When you upgrade to a paid plan, don't expect the error to disappear immediately, as @dcferreira mentioned in the comment above. It might take a few minutes to more than an hour after the upgrade before the error disappears. In the comment below, @JoeMornin confirmed that it took 10 minutes for his paid account to become active. In the meantime, he was getting the following error: You've reached your usage limit. See your usage dashboard and billing settings for more details. If you have further questions, please contact us through our help center at help.openai.com.

评论作者信息不可用Accepted221 votes

I was facing the same error, and for me the steps were: Add a credit or debit card in payment methods. Generate a new API key in user preferences. (Optional) Delete the old API key. Be sure to set limits to not incur in charges This are the limits for gpt-3.5-turbo: RPM 3,500 and TPM 90,000.

评论作者信息不可用17 votes

Just create a new API Key and use it. It worked for me.

评论作者信息不可用7 votes
源数据· Raw Archive
source
Stack Overflow
upstream_source
stackoverflow
upstream_item_id
75898276
daily_ranking_item_id
5436411d-b6ed-456b-ac96-612375684979
rank_date
2026-06-01
rank
2
name
OpenAI API error 429: "You exceeded your current quota, please check your plan and billing details"
tagline
python, prompt, openai-api, completion, chatgpt-api
description
I'm making a Python script to use OpenAI via its API. However, I'm getting this error: openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details My script is the following: #!/usr/bin/env python3.8 # -*- coding: utf-8 -*- import openai openai.api_key = "<My PAI Key>" completion = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "user", "content": "Tell the world about the ChatGPT API in the style of a pirate."} ] ) print(completion.choices[0].message.content) I'm declaring the shebang python3.8 , because I'm using pyenv . I think it should work, since I did 0 API requests, so I'm assuming there's an error in my code.
votes_count
185
comments_count
5
created_at_on_source
2023-03-31T11:58:04.000Z
topics
pythonpromptopenai-apicompletionchatgpt-api
media / source-specific data
{
  "stackoverflow": {
    "score": 185,
    "view_count": 486307,
    "is_answered": true,
    "top_answers": [
      {
        "body": "TL;DR: You need to upgrade to a paid plan. Set up a paid account, add a credit or debit card, and generate a new API key if your old one was generated before the upgrade. It might take 10 minutes or so after you upgrade to a paid plan before the paid account becomes active and the error disappears. Problem As stated in the official OpenAI documentation : TYPE OVERVIEW RateLimitError Cause: You have hit your assigned rate limit. Solution: Pace your requests. Read more in our rate limit guide . Also, read more about Error Code 429 - You exceeded your current quota, please check your plan and billing details : This (i.e., 429 ) error message indicates that you have hit your maximum monthly spend (hard limit) for the API. This means that you have consumed all the credits or units allocated to your plan and have reached the limit of your billing cycle. This could happen for several reasons, such as: You are using a high-volume or complex service that consumes a lot of credits or units per request. You are using a large or diverse data set that requires a lot of requests to process. Your limit is set too low for your organization’s usage. Did you sign up some time ago? You're getting error 429 because either you used all your free tokens or 3 months have passed since you signed up. As stated in the official OpenAI article : To explore and experiment with the API, all new users get $5 worth of free tokens. These tokens expire after 3 months. After the quota has passed you can choose to enter billing information to upgrade to a paid plan and continue your use of the API on pay-as-you-go basis. If no billing information is entered you will still have login access, but will be unable to make any further API requests. Please see the pricing page for the latest information on pay-as-you-go pricing. Note: If you signed up earlier (e.g., in December 2022), you got $18 worth of free tokens. Check your API usage in the usage dashboard . For example, my free trial expires tomorrow and this is what I see right now in the usage dashboard: This is how my dashboard looks after expiration: If I run a simple script after my free trial has expired, I get the following error: openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details. Did you create your second OpenAI account? You're getting error 429 because you created a second OpenAI account with the same phone number. It seems like free credit is given based on phone numbers. As explained on the official OpenAI forum by @SapphireFelineBytes : I created an Open AI account in November and my $18 credits expired on March 1st. So, like many of you here, I tried creating a new account with a different email address, but same number. They gave me $0 credits. I tried now with a different phone number and email. This time I got $5 credits. It's confirmed that free credit is given based on phone numbers, as explained on the official OpenAI forum by @logankilpatrick : Also note, you only get free credits for the first account associated with your phone number. Subsequent accounts are not granted free credits. Solution Try to do the following: Set up paid account . Add a credit or debit card . Generate a new API key if your old API key was generated before you upgraded to the paid plan. When you upgrade to a paid plan, don't expect the error to disappear immediately, as @dcferreira mentioned in the comment above. It might take a few minutes to more than an hour after the upgrade before the error disappears. In the comment below, @JoeMornin confirmed that it took 10 minutes for his paid account to become active. In the meantime, he was getting the following error: You've reached your usage limit. See your usage dashboard and billing settings for more details. If you have further questions, please contact us through our help center at help.openai.com.",
        "score": 221,
        "answer_id": 75898717,
        "is_accepted": true
      },
      {
        "body": "I was facing the same error, and for me the steps were: Add a credit or debit card in payment methods. Generate a new API key in user preferences. (Optional) Delete the old API key. Be sure to set limits to not incur in charges This are the limits for gpt-3.5-turbo: RPM 3,500 and TPM 90,000.",
        "score": 17,
        "answer_id": 76221115,
        "is_accepted": false
      },
      {
        "body": "Just create a new API Key and use it. It worked for me.",
        "score": 7,
        "answer_id": 76200742,
        "is_accepted": false
      }
    ],
    "answer_count": 5,
    "accepted_answer_id": 75898717,
    "last_activity_date": 1736482616
  }
}
raw_payload
{
  "stats": {
    "score": 185,
    "view_count": 486307,
    "is_answered": true,
    "answer_count": 5,
    "creation_date": 1680263884,
    "last_edit_date": 1704294387,
    "accepted_answer_id": 75898717,
    "last_activity_date": 1736482616
  },
  "api_wrapper": {
    "backoff": null,
    "has_more": true,
    "page_size": 8,
    "quota_max": 300,
    "quota_remaining": 251
  },
  "question_id": 75898276,
  "answer_fetch": {
    "has_more": true,
    "answers_fetched": 3,
    "answer_page_size": 3
  },
  "snapshot_version": "stackoverflow_question_v1"
}
source_raw_snapshot
{
  "id": "dfef283d-2267-4706-9dca-cb6a97bc49b3",
  "daily_ranking_item_id": "5436411d-b6ed-456b-ac96-612375684979",
  "source": "stackoverflow",
  "external_id": "75898276",
  "fetched_at": "2026-05-31T22:01:57.241Z",
  "question_raw": {
    "body": "<p>I'm making a Python script to use OpenAI via its API. However, I'm getting this error:</p>\n<blockquote>\n<p>openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details</p>\n</blockquote>\n<p>My script is the following:</p>\n<pre class=\"lang-py prettyprint-override\"><code>#!/usr/bin/env python3.8\n# -*- coding: utf-8 -*-\n\nimport openai\nopenai.api_key = &quot;&lt;My PAI Key&gt;&quot;\n\ncompletion = openai.ChatCompletion.create(\n  model=&quot;gpt-3.5-turbo&quot;,\n  messages=[\n    {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Tell the world about the ChatGPT API in the style of a pirate.&quot;}\n  ]\n)\n\nprint(completion.choices[0].message.content)\n</code></pre>\n<p>I'm declaring the shebang <code>python3.8</code>, because I'm using <a href=\"https://github.com/pyenv/pyenv\" rel=\"noreferrer\">pyenv</a>. I think it should work, since I did 0 API requests, so I'm assuming there's an error in my code.</p>\n",
    "link": "https://stackoverflow.com/questions/75898276/openai-api-error-429-you-exceeded-your-current-quota-please-check-your-plan-a",
    "tags": [
      "python",
      "prompt",
      "openai-api",
      "completion",
      "chatgpt-api"
    ],
    "owner": {
      "link": "https://stackoverflow.com/users/3018860/unix",
      "user_id": 3018860,
      "user_type": "registered",
      "account_id": 3235065,
      "reputation": 2844,
      "accept_rate": 89,
      "display_name": "Unix",
      "profile_image": "https://www.gravatar.com/avatar/edec84abcde58e8f5d45a7e5522ff1e1?s=256&d=identicon&r=PG&f=y&so-version=2"
    },
    "score": 185,
    "title": "OpenAI API error 429: &quot;You exceeded your current quota, please check your plan and billing details&quot;",
    "view_count": 486307,
    "closed_date": 1685124780,
    "is_answered": true,
    "question_id": 75898276,
    "answer_count": 5,
    "closed_reason": "Not suitable for this site",
    "creation_date": 1680263884,
    "last_edit_date": 1704294387,
    "accepted_answer_id": 75898717,
    "last_activity_date": 1736482616
  },
  "answers_raw": [
    {
      "body": "<p>TL;DR: You need to upgrade to a paid plan. Set up a paid account, add a credit or debit card, and generate a new API key if your old one was generated before the upgrade. It might take 10 minutes or so after you upgrade to a paid plan before the paid account becomes active and the error disappears.</p>\n<h2>Problem</h2>\n<p>As stated in the official <a href=\"https://platform.openai.com/docs/guides/error-codes/python-library-error-types\" rel=\"noreferrer\">OpenAI documentation</a>:</p>\n<div class=\"s-table-container\"><table class=\"s-table\">\n<thead>\n<tr>\n<th>TYPE</th>\n<th>OVERVIEW</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>RateLimitError</td>\n<td><strong>Cause:</strong> You have hit your assigned rate limit. <br><strong>Solution:</strong> Pace your requests. Read more in our <a href=\"https://platform.openai.com/docs/guides/rate-limits\" rel=\"noreferrer\">rate limit guide</a>.</td>\n</tr>\n</tbody>\n</table></div>\n<p>Also, read more about <a href=\"https://help.openai.com/en/articles/6891831-error-code-429-you-exceeded-your-current-quota-please-check-your-plan-and-billing-details\" rel=\"noreferrer\">Error Code 429 - You exceeded your current quota, please check your plan and billing details</a>:</p>\n<blockquote>\n<p>This (i.e., <code>429</code>) error message indicates that you have hit your maximum monthly\nspend (hard limit) for the API. This means that you have consumed all\nthe credits or units allocated to your plan and have reached the limit\nof your billing cycle. This could happen for several reasons, such as:</p>\n<ul>\n<li><p>You are using a high-volume or complex service that consumes a lot of credits or units per request.</p>\n</li>\n<li><p>You are using a large or diverse data set that requires a lot of requests to process.</p>\n</li>\n<li><p>Your limit is set too low for your organization’s usage.</p>\n</li>\n</ul>\n</blockquote>\n<br>\n<h3>Did you sign up some time ago?</h3>\n<p>You're getting error <code>429</code> because either you used all your free tokens or 3 months have passed since you signed up.</p>\n<p>As stated in the official <a href=\"https://help.openai.com/en/articles/4936830-what-happens-after-i-use-my-free-tokens-or-the-3-months-is-up-in-the-free-trial\" rel=\"noreferrer\">OpenAI article</a>:</p>\n<blockquote>\n<p>To explore and experiment with the API, all new users get $5\nworth of free tokens. These tokens expire after 3 months.</p>\n<p>After the quota has passed you can choose to enter <a href=\"https://platform.openai.com/account/billing\" rel=\"noreferrer\">billing information</a>\nto upgrade to a paid plan and continue your use of the API on\npay-as-you-go basis. If no billing information is entered you will\nstill have login access, but will be unable to make any further API\nrequests.</p>\n<p>Please see the <a href=\"https://openai.com/pricing\" rel=\"noreferrer\">pricing</a> page for the latest information on\npay-as-you-go pricing.</p>\n</blockquote>\n<p><em>Note: If you signed up earlier (e.g., in December 2022), you got $18 worth of free tokens.</em></p>\n<p>Check your API usage in the <a href=\"https://platform.openai.com/account/usage\" rel=\"noreferrer\">usage dashboard</a>.</p>\n<p>For example, my free trial expires tomorrow and this is what I see right now in the usage dashboard:</p>\n<p><a href=\"https://i.sstatic.net/nfa3e.png\" rel=\"noreferrer\"><img src=\"https://i.sstatic.net/nfa3e.png\" alt=\"Before expiration\" /></a></p>\n<p>This is how my dashboard looks after expiration:</p>\n<p><a href=\"https://i.sstatic.net/EfsOf.png\" rel=\"noreferrer\"><img src=\"https://i.sstatic.net/EfsOf.png\" alt=\"After expiration\" /></a></p>\n<p>If I run a simple script after my free trial has expired, I get the following error:</p>\n<blockquote>\n<p>openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.</p>\n</blockquote>\n<br>\n<h3>Did you create your second OpenAI account?</h3>\n<p>You're getting error <code>429</code> because you created a second OpenAI account with the same phone number. It seems like free credit is given based on phone numbers.</p>\n<p>As explained on the official <a href=\"https://community.openai.com/t/how-can-i-get-free-trial-credits/26742/19\" rel=\"noreferrer\">OpenAI forum by @SapphireFelineBytes</a>:</p>\n<blockquote>\n<p>I created an Open AI account in November and my $18 credits expired on\nMarch 1st. So, like many of you here, I tried creating a new account\nwith a different email address, but same number. They gave me $0\ncredits.</p>\n<p>I tried now with a different phone number and email. This time I got\n$5 credits.</p>\n</blockquote>\n<p>It's confirmed that free credit is given based on phone numbers, as explained on the official <a href=\"https://community.openai.com/t/how-can-i-get-free-trial-credits/26742/27\" rel=\"noreferrer\">OpenAI forum by @logankilpatrick</a>:</p>\n<blockquote>\n<p>Also note, you only get free credits for the first account associated\nwith your phone number. Subsequent accounts are not granted free credits.</p>\n</blockquote>\n<h2>Solution</h2>\n<p>Try to do the following:</p>\n<ol>\n<li><a href=\"https://platform.openai.com/account/billing/overview\" rel=\"noreferrer\">Set up paid account</a>.<br></li>\n<li><a href=\"https://platform.openai.com/account/billing/payment-methods\" rel=\"noreferrer\">Add a credit or debit card</a>.<br></li>\n<li><a href=\"https://platform.openai.com/account/api-keys\" rel=\"noreferrer\">Generate a new API key</a> if your old API key was generated before you upgraded to the paid plan.</li>\n</ol>\n<p>When you upgrade to a paid plan, don't expect the error to disappear immediately, as @dcferreira mentioned in the comment above. It might take a few minutes to more than an hour after the upgrade before the error disappears.</p>\n<p>In the comment below, @JoeMornin confirmed that it took 10 minutes for his paid account to become active. In the meantime, he was getting the following error:</p>\n<blockquote>\n<p>You've reached your usage limit. See your usage dashboard and billing settings for more details. If you have further questions, please contact us through our help center at help.openai.com.</p>\n</blockquote>\n",
      "owner": {
        "link": "https://stackoverflow.com/users/10347145/rok-benko",
        "user_id": 10347145,
        "user_type": "registered",
        "account_id": 14324749,
        "reputation": 23763,
        "display_name": "Rok Benko",
        "profile_image": "https://i.sstatic.net/3OJWR.jpg?s=256"
      },
      "score": 221,
      "answer_id": 75898717,
      "is_accepted": true,
      "question_id": 75898276,
      "creation_date": 1680266859,
      "last_edit_date": 1736482616,
      "content_license": "CC BY-SA 4.0",
      "last_activity_date": 1736482616
    },
    {
      "body": "<p>I was facing the same error, and for me the steps were:</p>\n<ol>\n<li>Add a credit or debit card in payment methods.</li>\n<li>Generate a new API key in user preferences.</li>\n<li>(Optional) Delete the old API key.</li>\n<li>Be sure to set limits to not incur in charges</li>\n</ol>\n<p>This are the limits for gpt-3.5-turbo: RPM 3,500 and    TPM 90,000.</p>\n",
      "owner": {
        "link": "https://stackoverflow.com/users/21873309/toni-verger",
        "user_id": 21873309,
        "user_type": "registered",
        "account_id": 28571107,
        "reputation": 171,
        "display_name": "Toni Verger",
        "profile_image": "https://lh3.googleusercontent.com/a/AGNmyxbJINyqzFqf1frI2Qv6GQoeD57EOict32_wnsA9lpU=k-s256"
      },
      "score": 17,
      "answer_id": 76221115,
      "is_accepted": false,
      "question_id": 75898276,
      "creation_date": 1683739474,
      "last_edit_date": 1704422130,
      "content_license": "CC BY-SA 4.0",
      "last_activity_date": 1704422130
    },
    {
      "body": "<p>Just create a new API Key and use it. It worked for me.</p>\n",
      "owner": {
        "link": "https://stackoverflow.com/users/6060723/nayan-dhabarde",
        "user_id": 6060723,
        "user_type": "registered",
        "account_id": 8038257,
        "reputation": 2446,
        "display_name": "nayan dhabarde",
        "profile_image": "https://i.sstatic.net/eL5Id.jpg?s=256"
      },
      "score": 7,
      "answer_id": 76200742,
      "is_accepted": false,
      "question_id": 75898276,
      "creation_date": 1683549946,
      "last_edit_date": 1691967237,
      "content_license": "CC BY-SA 4.0",
      "last_activity_date": 1691967237
    }
  ],
  "tags_raw": [
    "python",
    "prompt",
    "openai-api",
    "completion",
    "chatgpt-api"
  ],
  "stats_raw": {
    "score": 185,
    "view_count": 486307,
    "is_answered": true,
    "answer_count": 5,
    "creation_date": 1680263884,
    "last_edit_date": 1704294387,
    "accepted_answer_id": 75898717,
    "last_activity_date": 1736482616
  },
  "selection_meta": {
    "site": "stackoverflow",
    "api_wrapper": {
      "backoff": null,
      "has_more": true,
      "page_size": 8,
      "quota_max": 300,
      "quota_remaining": 251
    },
    "answer_fetch": {
      "backoff": null,
      "has_more": true,
      "answers_fetched": 3,
      "quota_remaining": 224,
      "answer_page_size": 3
    },
    "snapshot_version": "stackoverflow_question_v1",
    "selection_strategy": "tag_whitelist_unanswered_high_score_recent_active"
  },
  "created_at": "2026-05-31T22:01:57.343Z",
  "updated_at": "2026-05-31T22:01:57.343Z"
}