codex icon indicating copy to clipboard operation
codex copied to clipboard

Rate limit reached for o4-mini

Open danielj86 opened this issue 1 year ago • 28 comments

[Error]: Rate limit reached for o4-mini in organization org-******* on tokens per min (TPM): Limit 200000, Used 162960, Requested 42288. Please try again in 1.574s. Visit https://platform.openai.com/account/rate-limits to learn more. at e.a [as iterator] (file:///Users//.nvm/versions/node/v23.7.0/lib/node_modules/@openai/codex/dist/cli.js:443:1514) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async I0.run (file:///Users//.nvm/versions/node/v23.7.0/lib/node_modules/@openai/codex/dist/cli.js:460:2513) { status: undefined, headers: undefined, request_id: undefined, error: { type: 'tokens', code: 'rate_limit_exceeded', message: 'Rate limit reached for o4-mini in organization org-**** on tokens per min (TPM): Limit 200000, Used 162960, Requested 42288. Please try again in 1.574s. Visit https://platform.openai.com/account/rate-limits to learn more.', param: null }, code: 'rate_limit_exceeded', param: null, type: 'tokens' }

danielj86 avatar Apr 16 '25 19:04 danielj86

We're working on a fix here to handle these gracefully and continue.

tibo-openai avatar Apr 16 '25 19:04 tibo-openai

@danielj86 this error is expected because:

  1. you have a limit of 200000 tokens per minute
  2. you've used 162960 tokens within the current minute
  3. you are requesting an additional 42288 tokens within the current minute which would make you go over your TPM limit of 200000

theabhinavdas avatar Apr 16 '25 19:04 theabhinavdas

The plan is to sleep and retry later when there are tokens again to be used.

tibo-openai avatar Apr 16 '25 19:04 tibo-openai

@theabhinavdas thank you for the math. it was very helpful.

danielj86 avatar Apr 16 '25 20:04 danielj86

@tibo-openai i like the speed of codex compared to claude code. it will be much better to incrase API limits for codex users instead of adding sleeps, but i assume its not that easy. thanks

danielj86 avatar Apr 16 '25 20:04 danielj86

Rudimentary fix in https://github.com/openai/codex/pull/105, we're working on exposing more structured information that will allow this to be better in the not too distant future, but right now it will just sleep for 15s and retry.

tibo-openai avatar Apr 16 '25 20:04 tibo-openai

Fix released 0.1.4161352

tibo-openai avatar Apr 16 '25 21:04 tibo-openai

@tibo-openai - just installed and tested with 0.1.4161352 however the issue does not appear to be fixed. Still hitting a rate limit on tokens.

beamdotdev avatar Apr 17 '25 15:04 beamdotdev

@tibo-openai Still getting rate limits with 0.1.4161352 Its fair to expect OpenAI run the most basic sanity tests before releasing a product..

[Error]: Rate limit reached for o4-mini in organization org-on tokens per min (TPM): Limit 200000, Used 173143, Requested 41255. Please try again in 4.319s. Visit https://platform.openai.com/account/rate-limits to learn more. at e.a [as iterator] (file:///Users//.nvm/versions/node/v23.7.0/lib/node_modules/@openai/codex/dist/cli.js:445:1514) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async R0.run (file:///Users//.nvm/versions/node/v23.7.0/lib/node_modules/@openai/codex/dist/cli.js:462:2639) { status: undefined, headers: undefined, request_id: undefined, error: { type: 'tokens', code: 'rate_limit_exceeded', message: 'Rate limit reached for o4-mini in organization org-on tokens per min (TPM): Limit 200000, Used 173143, Requested 41255. Please try again in 4.319s. Visit https://platform.openai.com/account/rate-limits to learn more.', param: null }, code: 'rate_limit_exceeded', param: null, type: 'tokens' }

danielj86 avatar Apr 17 '25 16:04 danielj86

I hit the same issue, the annoying part is to give it context again especially if it was a long running task.

abhishek1234321 avatar Apr 19 '25 11:04 abhishek1234321

I’m getting exactly the same error, and since the Codex CLI kicks me out every time, I lose 200,000 tokens for nothing. The product is unusable in its current state.

Philippe-Cohen avatar Apr 19 '25 20:04 Philippe-Cohen

I just ran the Quickstart example:

codex "explain this codebase to me"

and hit the limit.

mimoralea avatar Apr 20 '25 01:04 mimoralea

What I hate is how nonsensical OpenAI rate limits are. It tells me to wait N minutes usually, some arbitrary number like 2.5 minutes, but you don't know actually how many tokens are actually released to use, so you wait that time, and hit with rate limit immediately. You wait overnight, and still can't get one request to finish without hitting rate limit. What's worse, is you're paying for a service to use, and can't use it. When you're new, getting into this for a project, you're simply forced to bend a knee to OpenAI and wait 7 days before tier gets upgraded. Like what? Excuse me? I gave you over hundred dollars, and have a ChatGPT account for years where I've paid hundreds...

WASasquatch avatar Apr 20 '25 16:04 WASasquatch

Still seeing the error in the latest version, installed yesterday. What perplexes me is I can get Claude code to review some code and fix it and it will tell me for example "used 10K tokens" but if I get o4-mini via Codex CLI to do the same thing I get the consumed 167890 tokens need 44506 tokens try again in 15ms rate limit etc - can someone explain to me why 1 tool seemingly is using less tokens Per Minute than the other? I mean If I am not mistaken isn't the context window only 200000 tokens? why is Codex burning through more tokens? in theory it would mean the cost per use would be higher as well given we are charged based on a MTOK / M tokens

FINDINGDORYBRO avatar Apr 21 '25 01:04 FINDINGDORYBRO

Still seeing the error in the latest version, installed yesterday. What perplexes me is I can get Claude code to review some code and fix it and it will tell me for example "used 10K tokens" but if I get o4-mini via Codex CLI to do the same thing I get the consumed 167890 tokens need 44506 tokens try again in 15ms rate limit etc - can someone explain to me why 1 tool seemingly is using less tokens Per Minute than the other? I mean If I am not mistaken isn't the context window only 200000 tokens? why is Codex burning through more tokens? in theory it would mean the cost per use would be higher as well given we are charged based on a MTOK / M tokens

I burned through over 10 bucks today, and haven't gotten a successful output (and put a lot of money into this system to use for a current project and two more we had lined up).

Here are my core concerns:

  • OpenAI's Token based Rate Limit is designed to not be easily circumvented by traditional calls-per-minute cooldown systems like graceful back-off. It's contextual based with tokens.
  • OpenAI's tier system coupled with the Token Rate Limits is designed to encourage pumping in money for tokens, climbing the "tiers", or just going straight to OpenAI for a contract, that other IDE's run off of, etc.
  • No back-end infrastructure, or support, and client-business trust. I've blown through tokens, and no requests are completing, just burned tokens. I should be refunded if the operation is not successful and I do not benefit. AI IDE's do this, such as Windsurf.
  • This is an official OpenAI repo, but seems to have been slapped together, and thrown up here on github with little planning. As a research preview, there should be a team staffed here engaging with us, and improving these core issues.

"In conclusion" (lol) I feel this is kinda geared at people with higher tiers, or (real) organization access via contracts to hound their servers.

WASasquatch avatar Apr 21 '25 03:04 WASasquatch

Still presented with

$ codex --version
0.1.2504172351
e [Error]: Rate limit reached for o4-mini in organization org-FaKQtnywbKBWxbRbD5wCG53p on tokens per min (TPM): Limit 200000, Used 150405, Requested 51478. Please try again in 564ms. Visit https://platform.openai.com/account/rate-limits to learn more.
    at e.a [as iterator] (file:///opt/homebrew/lib/node_modules/@openai/codex/dist/cli.js:449:1514)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async T0.run (file:///opt/homebrew/lib/node_modules/@openai/codex/dist/cli.js:466:2933) {
  status: undefined,
  headers: undefined,
  request_id: undefined,
  error: {
    type: 'tokens',
    code: 'rate_limit_exceeded',
    message: 'Rate limit reached for o4-mini in organization org-FaKQtnywbKBWxbRbD5wCG53p on tokens per min (TPM): Limit 200000, Used 150405, Requested 51478. Please try again in 564ms. Visit https://platform.openai.com/account/rate-limits to learn more.',
    param: null
  },
  code: 'rate_limit_exceeded',
  param: null,
  type: 'tokens'
}

PLEASE REOPEN

mathusiast avatar Apr 21 '25 05:04 mathusiast

Just installed codex today (version 0.1.2504172351) and immediately got this error.

aarondfrancis avatar Apr 21 '25 20:04 aarondfrancis

Just tried codex for the first time today, purchased enough credits to cover the usage, and hit this after about an hour. It would be great if codex could keep track of how many TPMs it's sending and rate-limit itself to avoid hitting the rate limit. It wouldn't be a huge deal to have it take longer to complete, but having it blow up and exit, losing the entire context makes it not very useful. It's the same problem with Github Copilot in agent mode, except it doesn't crash-out and lose the context.

FWIW, I'm using 0.1.2504211509 and this issue is still present.

codebrainz avatar Apr 22 '25 00:04 codebrainz

@tibo-openai STILL NOT FIXED!!! Lots of bugs open for this one issue?!? https://github.com/openai/codex/issues?q=is%3Aissue%20state%3Aopen%20rate%20limit

wbraswell avatar Apr 22 '25 01:04 wbraswell

Same here. Last version (0.1.2504172351) and the first demo query "explain codebase" hits this error.

averkij avatar Apr 22 '25 06:04 averkij