Repository navigation
Description
What issue are you seeing?
After a ChatGPT/Codex subscription usage limit is reached, the Codex App blocks all prompt submissions — even after switching to a custom model provider (e.g. via ~/.codex/config.toml [model_providers.*] pointing at a third-party or self-hosted OpenAI-compatible endpoint). The composer refuses to send, so the custom model becomes unusable until the quota window resets.
This looks like a genuine defect in the rate-limit recovery state, not a UI-only issue: the lock is set based on "the user has a ChatGPT account" rather than "the current model provider is the ChatGPT backend".
What steps can reproduce the bug?
-
Sign in to ChatGPT in Codex with a subscription that includes Codex (e.g. Plus/Pro).
-
Consume the usage limit (or wait for it to be exhausted), so the backend starts returning a usage-limit error.
-
Observe the app showing the "usage limit reached" / "buy more credits" state.
-
Configure a custom model provider in
~/.codex/config.toml:model = "my-custom-model" model_provider = "custom" [model_providers.custom] name = "Custom" base_url = "http://127.0.0.1:4000/v1" wire_api = "responses" env_key = "CUSTOM_API_KEY"
-
Select the custom model in the model picker and try to send any prompt.
-
The prompt cannot be sent. The custom provider is never reached.
Changing the model, restarting the app, or switching sessions does not reliably clear it.
Root cause
In codex-rs/tui/src/chatwidget/turn_runtime.rs, on_rate_limit_error sets:
// codex-rs/tui/src/chatwidget/turn_runtime.rs:483
self.input_queue.rate_limit_recovery_pending = self.has_chatgpt_account;rate_limit_recovery_pending then blocks every submission path:
| File | Lines | Blocks |
|---|---|---|
codex-rs/tui/src/chatwidget/input_submission.rs |
118, 164 | submitting a user message |
codex-rs/tui/src/chatwidget/input_flow.rs |
66, 182, 250 | queued / auto-sent input |
codex-rs/tui/src/chatwidget/startup_submission.rs |
56 | the first message |
codex-rs/tui/src/chatwidget/input_restore.rs |
165 | restoring a draft |
The flag is keyed on has_chatgpt_account and has no notion of the active model provider. The only places that clear it are:
codex-rs/tui/src/chatwidget/settings.rs:267—update_account_state(an account-identity change)codex-rs/tui/src/chatwidget/input_queue.rs:86— clearing the input queue
Neither is a model-provider switch, so switching to a custom provider leaves the lock in place.
Recovery only happens through finish_rate_limit_recovery(), which is driven by a successful account usage read:
TUI → app-server account/rateLimits/read
→ BackendClient::get_rate_limits_with_reset_credits()
→ GET {chatgpt_base_url}/wham/usage
That read is still tied to the ChatGPT backend, so it cannot recover a session that is now using a completely different provider.
What is the expected behavior?
Switching to a model provider that is not the ChatGPT backend should clear the usage-limit recovery lock, because the ChatGPT usage limit no longer constrains that provider.
Concretely, the lock should be scoped to the provider that produced the limit error, for example:
// codex-rs/tui/src/chatwidget/turn_runtime.rs
self.input_queue.rate_limit_recovery_pending =
self.has_chatgpt_account && self.current_provider_is_chatgpt_backend();and the same check should be applied when the provider changes, so that switching away from the ChatGPT backend releases any queued input that was being held.
A related detail: ordinary_usage_allowed is derived from the backend's rate_limit.allowed field (codex-rs/backend-client/src/client/rate_limit_resets.rs:39-44), and the TUI recovery check is in codex-rs/tui/src/chatwidget/backend_banners.rs:319-326. Both are ChatGPT-account-scoped and are re-read on a cadence that only makes sense for the ChatGPT backend.
Additional information
- Reproduction was done against the current
main(commitf7167ac895c869c60ae00a2d7f518a9977cd1205). - This affects users who combine a ChatGPT subscription with a custom/self-hosted provider fallback, which is a common setup for quota-constrained use.
- As a temporary workaround, users can point
chatgpt_base_urlat a proxy that reportsrate_limit.allowed = truefor the usage read, which unblocks the composer. That works becauseordinary_usage_allowedmaps directly to that field. It would be much better if the client scoped the lock itself instead of requiring a proxy. - The Codex CLI/TUI has the same behavior, so a fix in
codex-rs/tuiwould cover both surfaces.
Activity
cooltheobob commentedon Nov 4, 2026
same issue
yangj05 commentedon Nov 4, 2026
同样的问题,急!
stlin256 commentedon Nov 5, 2026
same issue
fix it plz
doer-ee commentedon Nov 21, 2026
Same behaviour in the macOS desktop app (26.1117.31558), which has a separate implementation in the webview. There the
"usage-limit"send block is driven byrate_limit.allowed === falsein the/wham/usageresponse and ignores the active provider.One note on the
chatgpt_base_urlproxy workaround: it did not work for the desktop app in my tests. SettingCODEX_API_BASE_URLalone sent nothing through the proxy, and the app only attaches credentials tolocalhost/ OpenAI / ChatGPT hosts. AddingCODEX_APP_SERVER_CHATGPT_BASE_URLrouted other backend requests, but/wham/usagenever passed through it and the app broke ("Workspace routing is unavailable").What did work was rewriting
rate_limit.allowedtotrueinside the page, which re-enabled sending to the custom provider. Details and caveats (real quota is unchanged; the server still enforces it for OpenAI models): https://doer.ee/blog/ai/codex-desktop-locked-after-chatgpt-quota-with-a-custom-provider