feat: don't close program when out of credits or when API key is missing

Resolved 💬 8 comments Opened Apr 16, 2025 by jayshrivastava Closed Aug 7, 2025
💡 Likely answer: A maintainer (tibo-openai, collaborator) responded on this thread — see the highlighted reply below.

Current behavior

Program exits with an error when OPENAI_API_KEY is missing, when I have insufficient_quota, rate_limit_exceeded or when my org isn't verified to use certain models. This happens after my first prompt.

Desired

It would be nice to keep the program open and print an error to the user when this happens.

View original on GitHub ↗

8 Comments

tibo-openai collaborator · 1 year ago

I believe there is an error printed and then the program exits? What would be the benefit of keeping codex running after hitting a fatal error that prevents it from doing anything useful in this case?

jayshrivastava · 1 year ago

Would the program would lose the work that it started if it hits insufficient_quota in the middle of execution?

jayshrivastava · 1 year ago

It think it does. I just a rate_limit_exceeded and I couldn't continue bc the program exited.

vonwerderc · 1 year ago

Yes, if there was a way to not lose all the progress when you hit the rate limit, that would be great. I had a few issues with that this afternoon.

tibo-openai collaborator · 1 year ago

We've pushed improvements for when rate limits are encountered. More to come.

jonchurch contributor · 1 year ago

You often run out of credits when deep down a rabbit hole, so being able to present a link to the user to go fill up their balance and then continue is a good UX.

Otherwise you lose all the context you've built up and have to start from scratch, which is a "walk away from using the product" moment at least for that sesssion.

I run into this screen many times in Claude code bc I load like $25 at a time, and the url prompt to go pay them more money works every single time.

codex-maintainers · 11 months ago

Thanks for the feedback! Please try again on the latest version of Codex CLI. If the issue persists, feel free to open a new issue or contribute to the codex-rs/ implementation.