Skip to content

Constant requests to https://chatgpt.com/backend-api/wham/usage even in API mode #10869

@iwinux

Description

@iwinux

What version of Codex CLI is running?

codex-cli 0.98.0

What subscription do you have?

ChatGPT Plus & internal API provider

Which model were you using?

gpt-5.2-codex

What platform is your computer?

Darwin 24.3.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Ghostty

What issue are you seeing?

When switching a Codex CLI session from ChatGPT auth to an API profile (custom endpoint), the CLI still issues periodic (every ~60s) GET https://chatgpt.com/backend-api/wham/usage requests using the auth.json access token. This happens even though prompts are correctly routed to the custom endpoint for the active profile.

What steps can reproduce the bug?

  1. Ensure valid ChatGPT auth.json exists (ChatGPT auth mode).
  2. Start Codex CLI and switch to a profile configured for API mode (custom endpoint).
  3. Send prompts (they go to the custom endpoint as expected).
  4. Observe network traffic.

What is the expected behavior?

Once the active profile is API mode (custom endpoint), no background requests should be sent to chatgpt.com/backend-api/wham/usage, and the ChatGPT access token should not be used.

Additional information

Below is the analysis by Codex itself 😉


The TUI rate-limit poller appears to start whenever cached ChatGPT auth exists, regardless of the active model provider or profile. It seems tied to ChatWidget::prefetch_rate_limits and does not check whether the current profile/provider requires OpenAI/ChatGPT auth.

Relevant code:

  • tui/src/chatwidget.rs
    ChatWidget::prefetch_rate_limits -> spawns a 60s interval poller that calls fetch_rate_limits -> backend-client/src/client.rs::get_rate_limits -> /wham/usage for ChatGPT base URL.

Suggested fix: guard the poller so it only runs when the active model provider requires OpenAI auth (or when the active profile is ChatGPT-auth). If the profile is API mode, skip the poller even if ChatGPT auth is present on disk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingrate-limitsIssues related to rate limits, quotas, and token usage reporting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions