-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
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?
- Ensure valid ChatGPT
auth.jsonexists (ChatGPT auth mode). - Start Codex CLI and switch to a profile configured for API mode (custom endpoint).
- Send prompts (they go to the custom endpoint as expected).
- 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 callsfetch_rate_limits->backend-client/src/client.rs::get_rate_limits->/wham/usagefor 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.