Repository navigation
Description
Area
Authentication and account pool
What are you trying to accomplish?
I run a pool of several ChatGPT Pro accounts behind OpenCodex. Some of them hold ChatGPT credits (many users received credits around OpenAI DevDay 2026). I want to decide, per account, whether OpenCodex may keep using that account after its usage limit is reached, which spends its credits, or should move on to the next account in the pool instead.
What prevents this today?
An account that has reached its usage limit stays selectable, and upstream keeps serving it from credits, so the pool spends credits without any setting that can stop it.
- Account selection only asks whether usage is under the auto-switch threshold (
hasCodexQuotaHeadroominsrc/codex/routing/selection.ts). An account leaves rotation on quota only when upstream refuses a request (429, then cooldown and avoidance). An account with credits is not refused at 100%, so it is never moved off. - With
autoSwitchThreshold: 0the active account is kept until a refusal, so it goes on spending credits while other accounts in the pool still have included usage. With a threshold above 0 the account is moved off earlier, but whenever no account is under the threshold, the pool still falls back to the lowest-usage account, which can be one at 100% with credits. src/codex/credits.tsdocuments the credits observation as "Display-only WHAM observation, never persisted or used for routing".
Observed on my pool (dashboard figures):
- One account went from 90% to 100% weekly while its credit balance went from 62,500 to 0. The evening before, while it read 90%, the other accounts in the pool read 0% weekly.
- An account at 100% weekly ("limit reached" on its card) is the pool's selected account, and its credit balance went from 15,115.78 to 15,089.71 between two reads a few minutes apart. I cannot tell how much of that came through OpenCodex and how much from other use of the same account.
The ChatGPT Usage page offers only "Add more" and "Automatic reload" for credits. There is no setting there to keep an account from spending credits, so the choice has to be made where the account is selected.
What should OpenCodex do?
Add one per-account switch on the Codex account card, next to the existing custom-threshold switch: "Use credits after the usage limit".
- On (the default): today's behaviour. Nothing changes for anyone who does not touch the switch.
- Off: once any of the account's usage windows (weekly, or monthly on 30-day plans, and the 5-hour window) reads 100%, it is treated as unavailable for selection and the pool moves on to the next account in its normal order, as if upstream had refused it. It becomes selectable again when its usage drops below 100%, for example after the window resets.
- Selection order, thresholds and priorities are otherwise unchanged. The switch only removes an account at 100%; it never reorders the pool.
- Reset credits (the ticket badge) are not touched: no change to
resetCreditAutoRedeemor the manual reset-credit actions. - The switch is independent of
showCodexCredits, which only controls what the card displays.
Example usage or interface
ops pro [ticket 1]
Weekly resets Oct 6 21:24 ██████████████ 100% · limit reached
Credits remaining ██████████████ 62,500
[ ] Custom account threshold
[ ] Use credits after the usage limit <- turned off by the operator
Pool with selection order A, then B, then the main account last:
A 100%, credits on, switch off -> skipped, its credits are kept
B 40% -> selected
B 100%, switch on -> keeps serving from its credits
B credits run out -> upstream refuses, cooldown, main account is next
The setting name is up to the maintainers, for example a per-account map in which only the accounts that turned the switch off are stored:
{ "codexAccountCreditsAfterLimit": { "<account-id>": false } }Alternatives or workarounds
autoSwitchThreshold: 100moves off an account at 100%, but it applies to the whole pool and also pulls in accounts the operator ranked last (for example a main account kept in reserve) before any credits are used.- Pausing an account by hand when it reaches 100% works but is manual, and the pause has to be lifted by hand after the reset.
codexPool.lowQuotaProtectioncan pause accounts at a threshold, but it is pool-wide and also needs a manual resume.
Additional context
Related: #657 (redeem a reset credit after exhaustion, closed as not planned, different resource), #822 (reset-credit auto-redemption before expiry), #3376 (reset windows as a scheduling input).
Edited on 2026-10-02: narrowed to a single per-account switch. The first version proposed a pool-wide "plan usage first, credits last" ordering, which conflicts with pools that keep an account in reserve at the end of the order.
I plan to open a pull request for this. No account identifiers or emails are included here.
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
Activity
sungyongcho commentedon Oct 1, 2026
Update with observations from my own pool. This answers the "Not verified" part of the description in one direction, with caveats below.
1. Credits are drawn down after the weekly window is exhausted.
On the Codex Auth card of one Pro account (the one that reset on Oct 6 21:24 local time), the Week bar went from 90% yesterday evening to 100% ("limit reached"). In the same period the credits row, which #6310 shows under the Week bar, went from 62,500 remaining to 0. So the ChatGPT backend kept serving this account past its weekly limit and the credit balance was spent. That matches OpenAI's description of credits (used automatically once included limits are reached, https://learn.chatgpt.com/docs/pricing).
Caveats: I cannot separate usage through OpenCodex from other use of the same account (ChatGPT app, other devices), so this is supporting evidence and not a controlled test. I did not capture the refusal that arrives once the balance reaches 0, and I did not observe the order within a single request.
2. The ChatGPT Usage page has no setting for the order.
I checked the Usage page for this account (Overview tab). It shows: Plan limits (the weekly limit and its reset time), Credits ("0 credits remaining", an "Add more" button and an "Automatic reload" switch, which is off), Usage limit resets (one "Full reset" available), Daily usage and Credit usage history. The only credit controls are buying and reloading; there is nothing that chooses whether credits or plan usage is consumed first. So the only place to control this for a pool is OpenCodex's account selection, which is what this issue proposes.
3. Why it matters for the pool.
The same pool has three Pro accounts, and with
autoSwitchThreshold: 0it does not move off an account before the upstream refuses it. Yesterday evening the pool read weekly 0% / 0% / 90%. Now it reads 0% / 100% / 100% and one account's credits are 0. That suggests credits were spent on one account while another still had its whole weekly allowance, which is the case the opt-in policy in this issue is meant to avoid. I did not record when each balance changed, so I cannot show the exact interleaving.No account identifiers are included here.
github-actions commentedon Oct 1, 2026
Automated translation bookkeeping — detected language: English.
[-][Feature]: opt-in per-account policy to continue on ChatGPT credits after the weekly window, plan usage first[/-][+][Feature]: per-account switch to stop using an account once it reaches its usage limit instead of spending its ChatGPT credits[/+]Ingwannu commentedon Oct 2, 2026
The October 2 scope clarification is useful: the requested contract is a default-on, per-account exclusion at an exhausted relevant quota window, not pool reordering, reserve-account policy, or reset-credit redemption. #6422 is the active implementation proposal; keeping this issue open until its actual selection/fallback behavior, stale/unknown quota handling, reset recovery, persistence and UI contract are reviewed and it lands on dev. The reported balance changes remain supporting observations, not a controlled attribution of spending to OpenCodex. I have not exercised any live account or credit-spending path. The account/routing changes still require the repository owner/independent boundary review; the current no-scan instruction is not a waiver of that requirement.
feat(codex): make spending ChatGPT credits after the usage limit opt-in
feat(codex): make spending ChatGPT credits after the usage limit opt-in
feat(codex): switch accounts at 100% by default and make spending Cha…
lidge-jun commentedon Oct 2, 2026
Fixed on
devby #6444 (10428d0120). An account at 100% of a usage window is now switched out by default and returns after its reset. To let accounts keep working from their ChatGPT credits, turn on Use credits in the Codex Auth header, or turn it on for individual accounts in each card's ⋯ menu. It ships in the next release.