Skip to content
Updated September 24, 2026

How to use multiple Codex accounts

A personal subscription for your own projects, a work account for the day job, maybe a client’s on top of that. Codex assumes you have one. Here is how to run several properly, and the two failure modes that quietly break a second account weeks after you set it up.

Short answer

Give each account its own CODEX_HOME directory and sign in inside each one separately. That variable points at the entire Codex state directory, so a second path means a second account with its own credentials, settings and history. Two rules keep it working: never copy auth.json between directories, and set cli_auth_credentials_store = "file" so credentials land in the directory rather than a shared keychain.

Give each account its own CODEX_HOME

Codex keeps its local state in one directory. OpenAI’s configuration documentation is direct about it: Codex stores its local state under CODEX_HOME, which defaults to ~/.codex. Inside sit config.toml, the cached credentials, history.jsonl when history is on, plus logs and caches.

That single variable is the whole mechanism. Point it at a different path and Codex reads a different account’s settings, credentials and history, with no knowledge that the first one exists.

# one directory per account
mkdir -p ~/.codex-personal ~/.codex-work

# sign in to each, separately
CODEX_HOME=~/.codex-personal codex login
CODEX_HOME=~/.codex-work     codex login

# then run whichever you want
CODEX_HOME=~/.codex-work codex

Typing that prefix every time gets old by the second day. Put it behind shell functions instead, so the account is something you choose rather than something you remember.

# ~/.zshrc
codex-personal() { CODEX_HOME="$HOME/.codex-personal" codex "$@"; }
codex-work()     { CODEX_HOME="$HOME/.codex-work"     codex "$@"; }

Each directory is a complete Codex home, which cuts both ways. Your work account will not see your personal session history, and any config.toml tuning you did has to be repeated in the other home or copied across deliberately. Isolation is the feature and also the chore.

Whether this stays a chore depends on how often you switch. Twice a week is fine. Several times a day, across a CLI and a desktop app, is where people start looking for something that manages it for them.

Why codex --profile is not the answer

Codex has a feature called profiles, and the name sends a lot of people down the wrong path. Profiles are configuration layers. Passing --profile deep-review loads config.toml and then overlays deep-review.config.toml from the same CODEX_HOME, which is how you switch model or reasoning settings.

Credentials are not part of that overlay. They belong to the home directory, so every profile inside one CODEX_HOME is the same signed-in account. If you want a second account, the variable is the lever, and the profile flag is unrelated.

Check where your credentials actually live

This is the step almost every guide on the subject skips, and it decides whether the isolation above is real.

Codex does not always keep credentials in auth.json. A setting called cli_auth_credentials_store picks the storage backend, and its default is auto, which prefers the operating system credential store and falls back to the file. On a Mac with a working keychain, auto generally means the keychain.

ValueWhere credentials goUse it when
autoOS credential store when available, otherwise auth.jsonThe default. Fine for one account, ambiguous for several.
fileauth.json inside that CODEX_HOMERunning multiple accounts. Storage follows the directory, so isolation is visible.
keyringOS credential storeYou want the keychain and run a single account.
ephemeralMemory only, for that sessionShared or throwaway machines, CI.

OpenAI’s documentation does not say whether keychain entries are separated by CODEX_HOME. Rather than guess, take the ambiguity off the table: write the setting into each account’s own config file, and the credential is then a file you can point at, inside the directory you named.

# in ~/.codex-personal/config.toml and ~/.codex-work/config.toml
cli_auth_credentials_store = "file"

The trade is explicit. OpenAI describes auth.json as a plaintext file, so you are choosing a readable file on disk over the keychain’s protection. For a multi-account setup that certainty is usually worth it. Keep the directories out of any repository, Dropbox folder or backup that leaves the machine.

Never copy auth.json between accounts

Plenty of switcher scripts work by moving auth.json files in and out of ~/.codex. The approach looks sound, passes every test you run on the day, and fails later.

OpenAI’s authentication documentation states that Codex refreshes tokens automatically during use, so the credential in the active directory is rewritten in place as you work. The maintainers of the open-source codex-accounts tool describe the consequence: OpenAI rotates an account’s refresh token on every login and invalidates the previous one server-side, so a stored copy older than the account’s most recent login is already dead no matter how well-formed it looks. We have not found that rotation behaviour in OpenAI’s own documentation, so treat the mechanism as third-party reporting; the symptom is easy to confirm yourself and turns up constantly in issue trackers.

Three specific ways it bites:

  • The stale copy. You switch back to an account after a fortnight. The file is intact, the JSON parses, and the token was rotated away days ago. You are signed out with no useful error.
  • The duplicate directory. The same account sitting in two homes has two credentials rotating against each other. Each refresh invalidates the other, so both eventually die.
  • The misdirected login. A plain codex login writes into whichever home is active. Sign in as personal while work is active and the work directory now holds a personal credential.

Setting CODEX_HOME avoids all three, because nothing ever moves. Each account refreshes its own credential in the directory it lives in. If you do want a switcher that swaps the active account rather than running several at once, prefer one that symlinks ~/.codex/auth.json into the account’s own file so refreshes write through, which is what codex-accounts does.

Running two Codex desktop apps at once

The CLI is the easy case. Two terminals with different CODEX_HOME values coexist without any special handling, since each process reads its own directory.

The desktop app adds a second problem on top. It is an Electron application, so launching it again hands you the existing window instead of starting a fresh instance. Getting two running means isolating Electron’s own data directory as well as the Codex home, using --user-data-dir alongside the environment variable. Edi Hasaj’s write-up on running two Codex accounts on macOS covers the launcher details, including the caution that this is a local workaround rather than a supported mode: a crash, a manual quit or a system sleep can interrupt it.

What the environment-variable method leaves unsolved

Everything above is worth doing and it is where most people stop. It is also worth being clear about what you still do not have, because no amount of shell configuration produces these.

Still missingWhy
One history across accountsEach home keeps its own sessions. Finding last month’s conversation means remembering which account you were using.
A view of which account has roomYou discover the limit by hitting it, mid-task, rather than before you start.
Carrying work across when one runs outThe accounts cannot share a session, so continuing elsewhere means copying context by hand.
A pooled allowanceQuota is metered per account and per plan. Nothing merges it, and any tool claiming otherwise is describing something else.

The pooled-allowance row is permanent, whatever any tool claims. The other three are interface problems, so a layer above Codex can address them, and it is worth checking which ones a given tool actually covers for Codex rather than for Claude Code. We list our own gaps below.

Doing it in Crowsnest

Crowsnest is ours, so weigh this section accordingly. It handles the directory bookkeeping described above and adds the part shell configuration cannot reach: a reading of how much each account has left, before you commit a task to one.

Registering an account creates its home at ~/.crowsnest/codex-accounts/<id>/ and hands back the exact command to run in your own terminal, CODEX_HOME=<dir> codex login. Crowsnest does not perform the sign-in. The OAuth exchange stays between you and OpenAI, and the credential is written by Codex into that directory.

It also never touches the credential afterwards. Crowsnest checks whether auth.json exists, to show the account as signed in, and reads nothing from it. No copying, no symlinking, no token parsing, which is the same discipline the section above asks of any switcher you might use instead.

Each account in its own home

One CODEX_HOME per registered account, created and tracked for you, with the login command generated per account.

Usage read per account

Crowsnest asks the Codex app-server for each signed-in account’s limits under that account’s own home, so the remaining window is visible before you start rather than after you hit it.

Continue when one runs out

After a Codex turn fails on quota, Crowsnest offers another signed-in account and previews exactly what the new conversation will receive.

An attributed fork, not a resume

The new thread starts under the other account’s home with a briefing of at most 8,000 characters. Omitted turns are counted in the text, and the original conversation is left untouched.

Where Codex support is thinner than Claude Code

Worth stating plainly, because the two providers are not at parity in the shipped app and a feature list would hide it.

  • The early warning is Claude Code only. Crowsnest can warn at 90% of a window and offer to continue before a failure, and today that path does not run for Codex conversations. A Codex conversation gets the offer after a turn has already failed.
  • Codex history is not attributed per account. The conversation gallery reads Codex sessions from the default ~/.codex home, so older Codex threads are not labelled by the account that wrote them, and reopening one runs it under the default account.
  • Automatic continuation acts only when the destination is unambiguous. You have to turn it on, and it proceeds only when exactly one other account of that provider is signed in. With two or more it draws a chooser and waits.
  • Signed in means the file is there. An expired credential still shows as signed in until a turn actually fails.

Quota is never pooled here either. Each account keeps its own meter, shown separately, because adding them together would hide which subscription is about to run out.

Several accounts per provider is a Pro feature. Standard drives one Claude Code or Codex account at a time and still browses and searches history. If you run a single Codex account, none of this applies to you and the environment variable above is the whole answer.

Questions behind the search

How do I use multiple Codex accounts?

Give each account its own CODEX_HOME directory and sign in separately inside each one. CODEX_HOME defaults to ~/.codex and holds that account’s config, credentials, history and logs, so pointing it somewhere else gives you a second isolated account. Do not copy auth.json between directories: Codex refreshes the token in place, and a copied credential stops working once the original refreshes.

Does codex --profile switch between accounts?

No. Profiles are configuration layers, not accounts. Passing --profile name loads config.toml and then overlays name.config.toml from the same CODEX_HOME, which changes settings such as model or reasoning effort. Authentication is unaffected, because it belongs to CODEX_HOME rather than to the profile.

Can I run two Codex accounts at the same time?

Yes for the CLI. Two shells with different CODEX_HOME values run concurrently without touching each other, because each process reads its own state directory. The desktop app is harder: it is an Electron application, so a second launch needs its own --user-data-dir or the system hands you back the first window.

Why does my second Codex account keep logging out?

Usually one of two causes. Either auth.json was copied rather than kept per account, so the copy holds a token that has since been rotated away, or credentials are in the operating system keychain instead of the account directory. Codex chooses its credential store with cli_auth_credentials_store, which defaults to auto and prefers the OS store. Set it to file in each account’s config.toml to keep credentials inside that directory.

Do multiple Codex accounts combine my usage limits?

No. Each account is metered and billed on its own plan, and no tool can merge them. Separate accounts let you keep working when one hits its limit, and they keep client or employer work on the right billing relationship. They do not create a larger shared allowance.

Is it against OpenAI’s terms to have more than one Codex account?

Holding separate accounts you are entitled to, such as a personal subscription and one your employer or client provides, is ordinary practice. Creating extra accounts to get around a rate limit on a single subscription is a different thing, and it is the sort of use providers restrict. Read your current OpenAI plan terms before you rely on any arrangement described here.

Codex behaviour above was checked against OpenAI’s published Codex documentation on September 24, 2026, with third-party sources named where first-party documentation is silent. Crowsnest behaviour was checked against the released application source on the same date. Codex changes quickly; follow OpenAI’s own documentation for current behaviour.