Skip to content

Codex App blocks all prompts after usage limit is reached, even when switching to a custom model provider #59175

Open

Description

@ok-dok

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?

  1. Sign in to ChatGPT in Codex with a subscription that includes Codex (e.g. Plus/Pro).

  2. Consume the usage limit (or wait for it to be exhausted), so the backend starts returning a usage-limit error.

  3. Observe the app showing the "usage limit reached" / "buy more credits" state.

  4. 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"
  5. Select the custom model in the model picker and try to send any prompt.

  6. 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 (commit f7167ac895c869c60ae00a2d7f518a9977cd1205).
  • 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_url at a proxy that reports rate_limit.allowed = true for the usage read, which unblocks the composer. That works because ordinary_usage_allowed maps 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/tui would cover both surfaces.

Activity

  1. added
    bug
    app
    custom-model
    rate-limits
    on Nov 3, 2026
  2. cooltheobob commented on Nov 4, 2026

    @cooltheobob

    same issue

  3. yangj05 commented on Nov 4, 2026

    @yangj05

    同样的问题,急!

  4. stlin256 commented on Nov 5, 2026

    @stlin256

    same issue
    fix it plz

  5. doer-ee commented on Nov 21, 2026

    @doer-ee

    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 by rate_limit.allowed === false in the /wham/usage response and ignores the active provider.

    One note on the chatgpt_base_url proxy workaround: it did not work for the desktop app in my tests. Setting CODEX_API_BASE_URL alone sent nothing through the proxy, and the app only attaches credentials to localhost / OpenAI / ChatGPT hosts. Adding CODEX_APP_SERVER_CHATGPT_BASE_URL routed other backend requests, but /wham/usage never passed through it and the app broke ("Workspace routing is unavailable").

    What did work was rewriting rate_limit.allowed to true inside 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugcustom-modelrate-limits

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions