跳到出发板
DIDRESET
UTC

Codex / Claude Code 多账号切换:官方方式、CODEX_HOME、常用工具

作者 vortwang更新于

每个账号各有自己的 5 小时与周窗口,切换不合并也不转移。OpenAI 的账号切换器「每个会话最多同时激活两个账号」,「切换不是合并」。Codex CLI:codex logout 再 codex login。Claude Code:/login,或设置 CLAUDE_CONFIG_DIR 并行运行多个账号。社区工具只列名不背书。

官方文档怎么说

步骤

官方层。ChatGPT 的账号切换器让你「stay signed in to two ChatGPT accounts at the same time and switch between them instantly」,「a maximum of two accounts active in the switcher per session」,且每个账号保持独立:切换不会「Combine billing or subscriptions」。Codex CLI 的凭据缓存在「auth.json under CODEX_HOME (defaults to ~/.codex)」;「run codex logout to clear the current credentials」,再「Run codex login, then complete the browser flow」即可换人登录。「The CLI and extension share the same cached login details」,所以一边登出另一边也登出。Claude Code 里 /login 是「Sign in to your Anthropic account」,/logout 是「Sign out from your Anthropic account」。

环境变量层。Claude Code 直接写在文档里:CLAUDE_CONFIG_DIR 会「Override the configuration directory (default: ~/.claude)」,并且「Useful for running multiple accounts side by side: for example, alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'」;凭据保存在该目录下,「so a session with a different CLAUDE_CONFIG_DIR reads a different entry」。Codex 把 CODEX_HOME 记为存放 config.toml、profile 文件与「CODEX_HOME/auth.json」的目录,但没有公布基于它的多账号做法;「defaults to ~/.codex」之外的都是社区实践。

社区层与额度。cc-switch、codex-switcher、Codex-Manager、codex-auth(openai/codex discussion #25630 的回帖里提到)这类工具做的是替换保存的 auth 文件或 profile;本站只列出供参考,没有审核它们的行为和是否符合服务条款。不管用哪种方式,额度都按账号计量:「Check Settings → Usage before a large task to see your remaining allowance, usage windows and reset times」看的是当前登录的账号,另一个账号的窗口照自己的时钟走。issue #44235 是一条用户报告:切换后 Codex Desktop 显示的周窗口在两个账号的值之间跳变;数字看起来串了,就彻底登出再重开。

  1. 先决定用哪一层

    网页与桌面 ChatGPT:内置切换器(「Open the account menu」、「Select "Add account"」)。Codex CLI:登出再登录。Claude Code:/login,或每个账号一个 CLAUDE_CONFIG_DIR。官方路径实在太慢,再考虑社区工具。

  2. ChatGPT 与 Codex 应用:添加第二个账号

    「Open the account menu」、「Select "Add account"」、「Sign in or create a new account.」「You do not need to log out of your current account to add another one.」每个会话最多两个账号同时激活;「you'll need to log out to access more than two at once.」

  3. Codex CLI:登出,再以另一个账号登录

    「For stored authentication, run codex logout to clear the current credentials」,或在会话里输入 /logout(「Sign out of Codex. Clear local credentials when using a shared machine.」)。然后「Run codex login, then complete the browser flow.」因为「The CLI and extension share the same cached login details」,IDE 扩展会跟着变。

  4. Claude Code:/login,或每个账号一个配置目录

    输入 /logout 再 /login 就地换账号。想让两个都保持登录,就用各自的目录启动:Anthropic 自己的例子是 alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'。每个目录有自己的凭据,两个会话永远不共享登录。

  5. 看刚切过去的账号还剩多少额度

    Codex:/status 打印当前登录账号的「5h limit」和「Weekly limit」进度条;Settings → Usage 显示同样的内容。Claude Code:/usage。另一个账号的窗口没有动,它们按自己的时钟补满。

  6. 数字看起来串了就彻底登出

    issue #44235 报告登录另一个账号后 Codex Desktop 显示的是前一个账号的周窗口。那是用户报告,不是有文档的行为;稳妥做法是登出、完全退出应用、重新打开再登录,然后重新看 Settings → Usage。

常见问题

切换账号后,两个账号的额度会加在一起吗?

不会。「Switching is not merging.」每个账号有自己的 5 小时与周窗口、自己的重置卡、自己的 credits;切换只是改变下一条请求从哪个账号的额度里扣。两者之间什么都不会转移。

同时用两个账号违反 OpenAI 或 Anthropic 的条款吗?

OpenAI 文档里的账号切换器是为了把工作与个人用量分开,Anthropic 文档里的 CLAUDE_CONFIG_DIR 是为了并行运行多个账号。两家帮助页都没有讨论用第二个个人订阅绕过限额;本站不提供服务条款方面的建议,社区切换工具各有自己的免责声明。

能用 CODEX_HOME 同时保留两个 Codex 登录吗?

OpenAI 文档说凭据在「auth.json under CODEX_HOME (defaults to ~/.codex)」,profile 文件在 $CODEX_HOME/profile-name.config.toml,但没有公布多账号的做法。社区工具把替换 auth 文件自动化了;本站只列名不背书。

出发板上的全员重置对我所有账号都生效吗?

全员重置「refreshes the eligible usage limits specified in the announcement」,对每个符合条件的账号各自生效,所以你的每个账号只要符合公告的资格就会各自被刷新。重置卡则是按账号发放,必须在那个账号里兑换。

来源

  1. OpenAI Help Center: Use multiple accounts with account switching (article 20001068, read via Wayback snapshot dated 2026-06-02)核实于 2026-09-18
  2. Codex docs: Authentication (learn.chatgpt.com): codex login, codex logout, login caching in auth.json under CODEX_HOME核实于 2026-09-18
  3. Codex CLI docs: Slash commands (learn.chatgpt.com): /logout, /status, /usage核实于 2026-09-18
  4. Codex docs: Config reference (learn.chatgpt.com): $CODEX_HOME profile files and CODEX_HOME/auth.json核实于 2026-09-18
  5. Claude Code docs: Slash commands (/login "Sign in to your Anthropic account", /logout, /usage)核实于 2026-09-18
  6. Claude Code docs: Environment variables (CLAUDE_CONFIG_DIR: "Useful for running multiple accounts side by side")核实于 2026-09-18
  7. Claude Code docs: Authentication (credentials kept under CLAUDE_CONFIG_DIR; /login and /logout manage .credentials.json)核实于 2026-09-18
  8. OpenAI Help Center: Managing usage with GPT-6 Astra in Work and Codex (article 20001516, read via Wayback snapshot dated 2026-09-16)核实于 2026-09-18
  9. openai/codex discussion #25630 (2026-06-01): "Switch Between Accounts" (user request; community tools named in replies)核实于 2026-09-18
  10. openai/codex issue #44235 (2026-09-09, user report): weekly quota/reset window switches after logging into another account核实于 2026-09-18
  11. Community tool: farion1231/cc-switch (GitHub; not endorsed by this site)核实于 2026-09-18
  12. Community tool: Lampese/codex-switcher (GitHub; not endorsed by this site)核实于 2026-09-18
  13. Community tool: qxcnm/Codex-Manager (GitHub; not endorsed by this site)核实于 2026-09-18
  14. Community tool: Loongphy/codex-auth (GitHub; named in discussion #25630; not endorsed by this site)核实于 2026-09-18

想让下一次重置直接打到手机上?

赞助商