openai / openai/codex

Automated Account Rotation

Open
#41,615 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auth CLI enhancement rate-limits session
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

CLI

What feature would you like to see?

This is not a duplicate of #9648. What I am currently using in my own fork supports all methods of authentication not just OAuth. It was a sizeable implementation that I would be happy to share with the team to get it added to main. 5.6 Sol was used to add the feature alongside full regression coverage on everything that was touched.

I would like the Codex CLI to support multiple OpenAI accounts and allow switching between them without losing the current conversation or project context.

A new /account command could provide a screen to:

  • Add, remove, update, and rename accounts
  • Sign in using any authentication method currently supported by Codex
  • View each account’s status, usage limits, and credits
  • Manually switch the current session to another account
  • Enable or disable automatic account rotation
  • Configure global or per-account usage thresholds

When the active account reaches its configured usage threshold or limit, Codex could automatically switch to another eligible account and continue the same conversation. The working directory, conversation history, tool results, permissions, and other local session state should remain intact.

Codex should display an account-switch announcement in the CLI, but it should not add that announcement to the model-visible conversation context.

Additional information

Automatic rotation should require at least two usable accounts.

Before enabling it, Codex should warn that remote prompt caches and response sessions may be account-specific. Switching accounts could therefore cause a large cache miss and require Codex to resend conversation context, consuming additional usage on the newly selected account. The user should explicitly accept this risk before automatic rotation can be enabled.

Suggested switching thresholds include:

  • ChatGPT/OAuth accounts: percentage of the reported usage limit
  • Credit-based accounts: remaining balance or credits consumed
  • API-key accounts: observed token usage or estimated cost

Switching should only happen at a safe request boundary. Codex must not switch during an active response, duplicate an already executed tool call, or expose credentials in conversation history or logs.

Manual account switching should remain available independently of automatic rotation. /status and other account-specific commands should apply only to the account currently serving the session.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the CLI entry points for authentication, session state, and the /status command, then assess where /account could fit. Done would require multiple supported authentication methods, manual and safe automatic switching without losing session context, credential protection, and regression coverage for the account-specific behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
authentication, cli, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.