Short answer: a 429 in Codex can come from at least three places, and each needs a different fix. Identify which one you have before doing anything else.
- Requests too fast (rate limiting): wait a moment and lower your concurrency. We tested with an AI Code With key: 40
codex execruns started at once gave 24 normal replies, while 16 exited after about 6 seconds withexceeded retry limit, last status: 429 Too Many Requests. Capped at 10 at a time, all 40 tasks succeeded in 15.6 seconds total. - Balance, spend, or usage limits (quota): retrying does nothing. Top up or raise the limit in your dashboard.
- ChatGPT plan usage windows: when you sign in with ChatGPT there is a 5-hour window and a weekly allowance; check what is left and when it resets with
/status. This is a different thing from a 429 returned by a third-party provider when you use an API key. - How Codex 0.166.0 retries: using a local test server that only returns 429, we confirmed that for a 429 without
Retry-After, Codex sends one request and gives up. Only whenRetry-Afteris present does it reconnect 5 times at that interval. So for batch jobs you have to control concurrency yourself; Codex will not ride out rate limits for you.
Create an API Key and connect Codex, Claude Code, or Cursor →
This article was checked against Codex CLI 0.166.0, the latest stable release as of November 2, 2026 (npm view @openai/codex version returns 0.166.0).
Quick reference: 429 causes and fixes
| Error text or error.code | Cause | What to do | Does retrying help? |
|---|---|---|---|
| Rate limit reached for requests | Requests are sent too fast | Lower the rate and respect Retry-After | Yes, after waiting |
| slow_down (rate_limit_error) | Request volume grew too fast | Respect Retry-After, lower the rate, then ramp up gradually | Yes, if you ramp up slowly |
| credit_balance_exhausted | Prepaid balance is used up | Top up your balance | No |
| organization_spend_limit_exceeded | Organization hit its spend limit | Raise or remove the organization spend limit | No |
| project_spend_limit_exceeded | Project hit its spend limit | Adjust the limit in project settings | No |
| organization_usage_limit_exceeded | Organization hit the usage limit OpenAI assigned | Request a higher usage limit | No |
| ChatGPT sign-in shows a "usage limit" message | Your plan's usage allowance is used up | Wait for the reset or buy extra credits | Only after the reset |
| 当前并发请求过多,请稍后重试 ("too many concurrent requests, try again later") | AI Code With gateway concurrency limit | Run fewer tasks at the same time | Yes, after lowering concurrency |
| Other 429s from a third-party provider | The provider's own rate limits, balance, or upstream channel status | Follow the provider's docs and dashboard | It depends |
Run these first to find out which case you are in:
# 1. Check the Codex version and how you are signed in
codex --version
codex login status
# 2. Inside a Codex session, check remaining usage (ChatGPT sign-in)
/status
The first six rows come from the OpenAI error codes documentation. The key point: 429s caused by balance, spend, or usage limits do not recover by retrying. OpenAI's documentation says that retrying billing, spend, or quota errors will not restore API access; you have to update the balance or limit first. The details follow below.
Test: what Codex 0.166.0 does with a 429
Setup: Linux, Codex CLI 0.166.0, model gpt-6.1-sol, AI Code With as the provider, config written to a separate CODEX_HOME directory. Every task was a codex exec run with a one-line prompt asking it to reply with OK only. Tested on the afternoon of November 2, 2026 (UTC+8).
1. A single request works
OpenAI Codex v0.166.0
model: gpt-6.1-sol
provider: aicodewith
user
Reply with OK only
codex
OK
In our single-request runs it returned in 2.7 to 6.0 seconds from launch.
2. 40 codex exec runs at once: 16 hit 429
We started 40 codex exec runs in the background at the same time:
| Metric | Result |
|---|---|
| Normal replies | 24, taking 2.9 to 27.3 seconds |
| Exited with 429 | 16, each one at about 6.0 seconds |
| Whole batch | 27.3 seconds |
A failed task printed this (the request id changes every time):
ERROR: exceeded retry limit, last status: 429 Too Many Requests, request id: req_1793607199460_94e43634
Sending 60 requests to the API directly with curl at the same moment gave 26 responses with 200 and 34 with 429, with this body:
{"error":"当前并发请求过多,请稍后重试 (request_id: req_1793607063535_b547062b)"}
The message means "too many concurrent requests, please try again later". All these 429s came back after about 5.2 to 5.4 seconds, and the response headers had no Retry-After. With 20 requests at once, all returned 200.
3. Limit concurrency to 10: all 40 succeed
seq 1 40 | xargs -P 10 -I{} sh -c 'codex exec --skip-git-repo-check "Reply with OK only" > out/{}.txt 2>&1'
All 40 tasks succeeded with zero 429s, and the batch took 15.6 seconds, faster than running without a limit (27.3 seconds with 16 failures). Under rate limiting, the most effective fix is not retrying but sending less in the first place.
4. Does Codex's automatic retry cover 429?
To see Codex's own retry logic clearly, we wrote a local test server that only returns errors, pointed the provider's base_url at it, and logged the time of every request Codex sent:
| Test server returns | Retry settings | Requests sent by Codex | Time | Final error |
|---|---|---|---|---|
| 429, no Retry-After | Default | 1 | 0.3 s | exceeded retry limit, last status: 429 Too Many Requests |
| 429, Retry-After: 2 | Default | 6 (2.0 s apart) | 10.3 s | Same, with Reconnecting... 2/5 to 5/5 in between |
| 429, Retry-After: 2 | stream_max_retries = 2 | 3 | 4.3 s | Same, with Reconnecting... 1/2 and 2/2 |
| 429, Retry-After: 2 | request_max_retries = 0 | 6 | 10.3 s | Same as default |
| 503 | Default | 30 | 24.9 s | unexpected status 503 Service Unavailable |
| 503 | request_max_retries = 1, stream_max_retries = 1 | 4 | 0.8 s | Same |
| 503 | Both set to 0 | 1 | 0.3 s | Same |
What the table shows:
- For a 429 without
Retry-After, Codex 0.166.0 does not retry. The error saysexceeded retry limit, but only one request was sent. The concurrency 429 from our gateway is this kind, so Codex exits right away. - For a 429 with
Retry-After, Codex waits the given number of seconds, and the number of reconnects is controlled bystream_max_retries(default 5).request_max_retrieshas no effect on it. - 5xx errors are retried at both levels: each round makes
request_max_retriesattempts (default 4, with backoff of about 0.2, 0.4, 0.8, and 1.6 seconds), then the whole thing reconnectsstream_max_retriestimes (default 5). With default settings, one failure turns into 30 requests over about 25 seconds.
Both settings go in the provider section of your global ~/.codex/config.toml; see "Codex's own retry settings" below.
Why "just wait and retry" only works some of the time
When people see a 429, the first instinct is to wait a few seconds and try again. That only helps when requests are too fast. A 429 from the OpenAI API falls into at least two broad groups:
- Rate-related: requests or tokens are sent too fast. Waiting and lowering the rate fixes it.
- Account-related: exhausted balance, spend limit, or usage limit. Waiting half an hour will not fix it.
OpenAI also notes that for billing-related errors you should look at error.code to find the exact cause, because the broader error.type may show insufficient_quota for all of them. So the first step in troubleshooting a 429 is always getting the full error.
Get the full error: open the logs on your system
Often Codex only shows a short message and you can't see the full error.code. The logs help here. The official Configuration Reference says Codex writes logs under $CODEX_HOME/log by default, and CODEX_HOME defaults to ~/.codex. If you set log_dir explicitly, Codex also writes a plain-text TUI log, codex-tui.log, in that directory.
To set a log directory for a single run, the official syntax is:
codex -c log_dir=./.codex-log
To look at the default log directory on each system:
macOS / Linux:
ls -la ~/.codex/log
Windows PowerShell:
Get-ChildItem "$env:USERPROFILE\.codex\log"
Search the logs for 429 and you will usually find the full error and code. With codex exec, the error is printed in the last few lines of the terminal, with a request id as in our test above; send that id along when you ask the provider for help. Logs may contain your prompts and project details, so check and remove sensitive content before sharing them, and never send your key along.
First, check which route you are on
Run:
codex login status
Then follow one of these three routes based on the result:
- ChatGPT sign-in: a 429 is usually about your plan's usage allowance.
- OpenAI API key: a 429 means whatever the OpenAI error code docs say.
- Third-party provider: the provider decides what a 429 means.
The three routes are handled completely differently, so don't apply what you learned on one to another.
Route 1: usage allowance with ChatGPT sign-in
If you sign in to Codex with a ChatGPT account and see messages like "usage limit" or "try again later", handle it through the usage window the product shows you. Don't convert it into API RPM or TPM just because it is also called a "limit"; the two systems are not the same table.
OpenAI's Codex pricing page says:
- How many messages you can send depends on the model, the size and complexity of the task, and whether it runs locally or in the cloud; similar-looking tasks can use different amounts.
- The page gives estimates of local messages per five hours for Plus and Standard Business plans. These are estimates, not fixed limits. Pro plans currently have no five-hour limit.
- You can see your current limits and reset times on the usage page, and inside a Codex CLI session you can use
/statusto see what is left. - If you hit the limit in the middle of a turn, Codex can finish that turn (subject to fair use limits).
- Plus and Pro users who reach the limit can buy extra credits to keep working without upgrading their plan.
So on this route: first check remaining usage and the reset time with /status; buy extra credits if it's urgent; otherwise wait for the reset. To use less, split big tasks into smaller ones and avoid unnecessarily long context. For how the billing options differ, see "How Codex Billing Works".
When does Codex usage reset?
With ChatGPT sign-in, Codex usage has two layers: a short 5-hour window and a longer weekly allowance. Either can run out first, and you have to wait for whichever one ran out to reset.
From the official docs: "The estimates below show local messages per five-hour period for Plus and Standard Business. Pro plans currently have no five-hour limit." and "Local messages and cloud chats share your plan's usage allowance. Weekly limits may also apply." Source: OpenAI: Codex Pricing.
| 5-hour window | Weekly allowance | |
|---|---|---|
| Applies to | Plus, Standard Business, etc. (Pro currently has none) | The docs say "Weekly limits may also apply" |
| When used up | Wait for this window to reset | Wait for the weekly reset; a fresh 5-hour window won't help |
| Where to check | Usage page or /status | Usage page or /status |
Check remaining usage and reset time with /status
Type /status in an interactive Codex CLI session to see what is left; for full limits and reset times, see the ChatGPT usage page.
From the official docs: "You can find your current limits in the usage dashboard. If you want to see your remaining limits during an active Codex CLI session, you can use /status." Source: OpenAI: Codex Pricing.
This is about the subscription allowance with ChatGPT sign-in. When you connect with an API key (including a relay key such as AI Code With), you don't use the subscription allowance, so there is no 5-hour window or weekly allowance; you check usage in the dashboard of the platform that issued the key. What you can hit instead is a concurrency or rate limit like the one in our test above.
Tibo's 28-day run and banked resets
Besides the automatic reset on your own account's cycle, OpenAI sometimes resets usage for all subscribers at once. This is not a fixed rule.
The most recent burst came during the 28-day run by Tibo (@thsottiaux), who leads Codex. According to an X trending summary, from October 5 to November 1 he gave Codex and ChatGPT Work users either a product improvement or a usage limit reset every day, and about 14 of the 28 days were reset days. The last two days were "banked resets" you can keep for later: according to @thsottiaux, on October 31 he teased "Next two days will be resets… banked…" (post), then posted "Banked 1/2" (post) and "Day 28/ Banked 2/2" (post). According to the X trending summary, these banked resets can be redeemed in account settings.
A few things to keep straight:
- A banked reset restores the usage window of a ChatGPT plan sign-in. It does nothing for 429s returned on an API key or by a third-party provider.
- These are personal posts and an X summary, not an official OpenAI announcement. Go by your own usage page and
/statusfor where to redeem and whether it has arrived. - According to user reports, a reset refills the bar rather than giving you a longer one ("day 15 gave me the bar back, not a bigger one", source), so it makes sense to run your big tasks just before a reset.
- The "Reset Card" going around on X is, according to user reports, just a joke meme; showing it to anyone won't get you a reset (source).
Can't wait for the reset?
Option 1: buy official credits
From the official docs: "ChatGPT Plus and Pro users who reach their usage limit can purchase additional credits to continue working without needing to upgrade their existing plan." Source: OpenAI: Codex Pricing.
Business, Edu, and Enterprise plans with flexible pricing can buy workspace credits.
Option 2: switch to an API key
The docs also say that once your subscription allowance runs out, you can switch to an API key billed by usage:
From the official docs: "All users may also run extra local chats using an API key, with usage charged at standard API rates." Source: OpenAI: Codex Pricing.
To use an AI Code With key, create one first:
Then put this in your global ~/.codex/config.toml (on Windows, %USERPROFILE%\.codex\config.toml) and replace YOUR_API_KEY with the key you just created:
model_provider = "aicodewith"
model = "gpt-6.1-sol"
[model_providers.aicodewith]
name = "aicodewith"
base_url = "https://api.aicodewith.ai/chatgpt/v1"
wire_api = "responses"
experimental_bearer_token = "YOUR_API_KEY"
Save it, run codex again, and send one line to confirm you get a reply:
codex exec "Reply with OK only"
Tested on Codex 0.166.0: the startup info showed model: gpt-6.1-sol and provider: aicodewith, and OK came back in a few seconds.
The key goes straight into experimental_bearer_token in the global config, so you don't need to set an environment variable. For what each field means, see the Codex config.toml configuration guide. For which wins when an environment variable conflicts with the config file, see How to configure Codex environment variables. For a 401 caused by a wrong key, see How to fix Codex 401 Unauthorized. To go back to your ChatGPT subscription allowance, delete or comment out the model_provider line.
With an API key you are no longer bound by the subscription's 5-hour and weekly allowances, but you will run into the rate limits of the platform that issued the key, such as the concurrency 429 in our test and the gateway_queue_full and Upstream rate limit exceeded errors below.
Route 2: OpenAI API key
When it really is a rate limit
If the error clearly says requests or tokens are rate limited, lower your concurrency first. OpenAI's guidance:
- If there is a
Retry-Afterresponse header, wait at least that long before retrying. - If there is no
Retry-After, use exponential backoff with some random jitter, and cap the number of retries.
Don't write a loop like this:
fail → retry immediately → fail → retry immediately → ...
It makes the rate limit harder to recover from. A safer approach:
fail → read Retry-After → lower concurrency → wait → retry one minimal request
slow_down is another kind of rate limit
OpenAI lists the slow_down code separately. It means your request volume grew too fast, and it can appear even when your totals are within your per-minute request and token limits. OpenAI's rule of thumb: once traffic reaches 1 million input tokens per minute, don't increase it by more than 50% every 15 minutes. The exact trigger varies by model and traffic.
So if you just raised codex exec concurrency from a few to dozens, a slow_down is to be expected. Ramp up gradually instead of going all the way at once.
Balance, spend, and usage limits
These 429s must be fixed in your account dashboard:
credit_balance_exhausted: the prepaid balance is used up. Top up.organization_spend_limit_exceeded: the organization hit its monthly spend limit, which applies to every project in it. Raise or remove it.project_spend_limit_exceeded: one project hit its own spend limit. Other projects keep working unless they hit theirs too.organization_usage_limit_exceeded: the organization hit the monthly usage limit OpenAI assigned. This is separate from the spend limit you set yourself; request a higher limit.
After fixing it, send one minimal request to verify. Don't restart every task the moment it recovers.
Route 3: third-party providers
If requests go through a third-party base URL, the provider decides what a 429 means. Check all of these:
- your balance with the provider;
- upstream channel status;
- concurrency limits;
- whether the current model is restricted;
- whether automatic retries are making things worse.
Three 429 errors on AICodeWith
If you call through AICodeWith, a 429 usually carries one of these three messages. None of them means your key or config is wrong:
| Error text | Meaning | What to do |
|---|---|---|
| 当前并发请求过多,请稍后重试 ("too many concurrent requests") | Too many requests were sent at the same moment, and the gateway rejected the excess | Run fewer tasks at once, for example cap concurrency with xargs -P 10 |
| gateway_queue_full | The upstream request queue is full for now | Wait a few seconds to a few dozen seconds before retrying; don't resend in a tight loop |
| Upstream rate limit exceeded | The upstream model service hit a rate limit | Lower concurrency, run fewer tasks at once, and retry after a pause |
All three are temporary, and the approach is the same: lower concurrency first, wait a little, and keep only one layer of retries (see "Codex's own retry settings" below). In our test the concurrency 429 had no Retry-After, so Codex did not retry it; for batch jobs you need to control concurrency in your script. If it keeps happening, check the current channel status on the channels page.
If you use AI Code With, you can check here:
- Channel status: https://aicodewith.ai/en/dashboard/channels?ref=docs&src=codex-429-too-many-requests
- Model list: https://aicodewith.ai/en/dashboard/pricing?ref=docs&src=codex-429-too-many-requests
- How channels and routes work: channel management docs and route selection docs
Switching channels reduces the impact of a single channel failing, but it can't guarantee a way around real upstream rate limits, account quotas, or organization limits.
Don't treat "auto-switching channels" as a cure-all
AI Code With's channels page is useful for checking channel status and available models on the third-party route, but "the next channel works" does not mean "every 429 can be bypassed". If the error comes from a real upstream rate limit, insufficient balance, or an organization or project limit, you still have to handle it by error code. Treat channel switching as an availability tool and 429 classification as a troubleshooting tool; don't mix them up.
If you don't have an account yet, sign up for AI Code With and check channels and usage in the console.
Don't confuse 429 with 503
Some "too busy" errors are not 429s. The OpenAI error codes docs also list a 503 with the code server_is_overloaded, meaning the requested model is temporarily overloaded. The difference: a 429 means your requests went over a limit; a 503 means the server is temporarily too busy.
The handling overlaps: if there is a Retry-After, wait at least that long in both cases. But if a 503 persists, OpenAI suggests checking the OpenAI status page for an ongoing incident rather than adjusting your account limits. In our test, Codex retried 503s much more aggressively than 429s (one failure became 30 requests by default), so Codex often rides out a 503 on its own, but not a 429.
If you write your own scripts against the API, note what OpenAI points out: the Python SDK raises RateLimitError for 429 and InternalServerError for 503. If your code only catches one, you'll miss the other. OpenAI recommends handling both and checking error.code.
Another error: Selected model is at capacity
If what you see isn't a 429 but "Selected model is at capacity. Please try a different model.", the model server is at full load (HTTP 503). That's not rate limiting and not an exhausted quota, and the fix is different: wait for it to continue or switch models. See "What to Do When Codex Says Selected model is at capacity". If the request never comes back and finally times out, see "How to Troubleshoot Codex Timeouts".
Codex's own retry settings
Codex has built-in retries for custom providers. The official Configuration Reference lists two related fields:
request_max_retries: how many times HTTP requests to the provider are retried, default 4;stream_max_retries: how many times an interrupted streaming response is retried, default 5.
Based on the tests above, in 0.166.0 they apply differently by error: 5xx is retried at both levels; a 429 with Retry-After is controlled only by stream_max_retries; a 429 without Retry-After is not retried. If you want failures to surface faster so your own script decides how to retry, turn them down:
[model_providers.aicodewith]
name = "aicodewith"
base_url = "https://api.aicodewith.ai/chatgpt/v1"
wire_api = "responses"
experimental_bearer_token = "YOUR_API_KEY"
request_max_retries = 1
stream_max_retries = 1
In our test, with these settings the same 503 produced only 4 requests and an error after 0.8 seconds, versus 30 requests over about 25 seconds with the defaults.
If you wrap another layer of retries in your script, a single failure can turn into dozens of requests, which is especially bad under rate limits. When running codex exec in batches, keep only one layer of retries and make it respect Retry-After. For more fields, see the Codex config.toml configuration guide.
A recommended troubleshooting order
- Save the full 429 error and the request id.
- Run
codex login statusto see whether you're on ChatGPT sign-in or an API key. - Check whether you go through a third-party provider.
- Look at
error.codeor the error text. - If it's a rate or concurrency limit, look at
Retry-After, concurrency, and request rate. - If it's a balance, spend, or usage limit, fix the account limit directly; don't retry.
- Verify recovery with one minimal request.
If only one model fails while others work, the problem may have moved from rate limiting to the model or routing layer; check the model ID and provider next.
How to confirm it's really fixed
After fixing a 429, don't restart every task right away. Confirm step by step:
- Send one short request and make sure it returns normally.
- On the API key route, confirm in the dashboard that balance, spend limits, and usage have updated.
- On the ChatGPT sign-in route, confirm with
/statusthat usage has been restored. - On a third-party provider, confirm in the call logs that requests succeed, and check which channel you're on.
- Finally, bring concurrency back up gradually and watch for a while before fully opening up.
That way, even if the problem isn't fully solved, you lose a request or two instead of the whole batch failing again.
How to avoid 429 in batch jobs
If you run batch or scheduled jobs with codex exec, prepare a few things in advance:
- Control concurrency: start small and increase only once it's stable. In our test, 40 tasks with
xargs -P 10all succeeded, while running them all at once failed 16. - Stagger start times: don't schedule every job on the hour at the same moment.
- Keep one layer of retries: rely on Codex's built-in retries or your script's, not both.
- Rerun failed tasks separately: when a concurrency 429 ends a run,
codex execexits with code 1. Pick out the failed tasks by exit code and rerun them at lower concurrency. - Set budget alerts: on the API key route, set spend limits and alerts in the dashboard ahead of time; it's easier to manage than a 429 halfway through a job.
- Log error codes: write
error.codeor the error text to your logs so you can tell at a glance which kind it was.
FAQ
How long do I wait after a Codex 429?
It depends on the cause. For rate or concurrency limits, wait for Retry-After or lower concurrency and retry right away; it usually recovers quickly. ChatGPT sign-in usage waits for the reset time, which you can see with /status. Balance or limit errors won't fix themselves; you have to handle them in the dashboard.
Does Codex retry a 429 automatically?
It depends on whether the response has Retry-After. In our test with Codex 0.166.0, a 429 without Retry-After was sent once and exited with exceeded retry limit; with Retry-After, Codex reconnected at that interval, 5 times by default, controlled by stream_max_retries.
How do I tell a rate limit from an insufficient balance?
Look at error.code in the full error. credit_balance_exhausted is a balance problem, anything with spend_limit or usage_limit is a limit problem, and only Rate limit reached, slow_down, and "too many concurrent requests" are rate or concurrency problems.
What should ChatGPT Plus users do when they hit the usage limit?
OpenAI's pricing page says Plus and Pro users who reach the limit can buy extra credits without upgrading. You can also wait for the reset.
Does switching to an API key fix 429?
With an API key, billing and limits follow API rules and the subscription allowance no longer applies, but the API has its own rate limits and spend limits, and third-party providers have their own concurrency limits.
Why do I get a 429 when I barely use it?
If you're on an API key, it may be a balance or project spend limit rather than heavy use. error.code will tell you.
How do I diagnose a 429 from a third-party service?
Go by the provider's docs and dashboard. Check your balance and channel status first, then whether only one model is restricted.
What does "当前并发请求过多" from AICodeWith mean?
It means "too many concurrent requests": too many requests were sent at the same moment. Run fewer Codex tasks at once. In our test, 40 tasks at concurrency 10 all succeeded.
What does gateway_queue_full from AICodeWith mean?
The upstream queue is full, which is temporary congestion. Wait a few seconds to a few dozen seconds, retry, and lower concurrency.
What's the difference between the Codex 5-hour limit and the weekly allowance?
The 5-hour window is the short cycle; Plus and similar plans have it, Pro currently doesn't. The weekly allowance is the long cycle. Whichever runs out first is the one you wait on; both show on the usage page and in /status.
Is there a 5-hour limit with an API key?
There's no subscription 5-hour or weekly allowance, but the platform that issued the key has its own rate limits.
Can a banked reset fix a 429 on an API key?
No. According to @thsottiaux and the X trending summary, banked resets were the usage resets given to ChatGPT plan users on the last two days of Tibo's 28-day run. They only apply to the subscription sign-in usage window and have nothing to do with 429s on an API key through a third-party provider.
Sign up for AI Code With and check channel status and usage in the console →
Related reading
- "Codex config.toml Configuration Guide"
- "How to Fix Codex 401 Unauthorized"
- "What to Do When Codex Says Selected model is at capacity"
- "How to Troubleshoot Codex Timeouts"
- "How to Use Codex"
- "How to Configure Codex Environment Variables"
- "How Codex Billing Works: ChatGPT, Credits, and API"



