Logging out of Codex removes the cached local sign-in from the current CLI or IDE extension environment so the machine can be left unauthenticated or switched to another account cleanly.
The codex logout command clears the cached login that Codex reuses between launches. Current OpenAI authentication docs say the CLI and IDE extension share that cached state, and the credentials are stored either in the operating system credential store or in auth.json under CODEX_HOME, which defaults to /~/.codex.
Local logout changes only the credentials cached on that machine. It does not revoke the upstream ChatGPT or API credential, so suspected exposure still requires separate revocation or rotation, and current OpenAI Help guidance says older API-key-based CLI setups can switch back to subscription access by logging out and starting Codex again.
$ codex login status Logged in using ChatGPT
This preflight confirms the local profile still has cached credentials before the logout command runs. API key profiles report API key authentication instead.
$ codex logout Successfully logged out
Current local verification with file-based cached credentials returned Successfully logged out and removed the local auth.json file from the isolated CODEX_HOME used for testing. The same command returned Not logged in and exited cleanly when no cached session was present.
$ codex login status Not logged in
This is the decisive success state after logout. In the same local verification, codex login status returned Not logged in and exited with status 1 once the cached login was gone.
$ codex login
Use How to log in to Codex with device authentication for headless terminals or How to log in to Codex with an API key for programmatic environments. OpenAI Help guidance for subscription access also notes the supported switch path of logging out and then starting Codex again on older API-key-based setups.