Guide contentsUsed a relay or CC Switch with Codex? Switch back to the ChatGPT sign-in

Used a relay or CC Switch with Codex? Switch back to the ChatGPT sign-in

After a relay or CC Switch, Codex keeps calling the third-party API and signing in to ChatGPT changes nothing. Copy the prompt below for an AI assistant that can run commands on your computer; it puts things back step by step, without reinstalling Codex.

  • Only API settings, environment variables and the saved login change; chats, skills and other settings stay.
  • config.toml and auth.json are backed up first, so you can undo it.
  • Reopen Codex afterwards and sign in with your ChatGPT account.

3 min read ·

Copy the prompt for an AI assistant

Please switch Codex on this computer back to signing in with my official ChatGPT account. I used a relay or CC Switch before and want the official setup back. Don't reinstall Codex, and don't delete my chats, skills or other settings.

Work in this order, and tell me what you will change before each change:

1. If CC Switch or a similar switcher is running, remind me to quit it so it doesn't write the settings back.
2. Find the Codex folder: the folder in the CODEX_HOME environment variable; if it isn't set, %USERPROFILE%\.codex on Windows and ~/.codex on macOS and Linux.
3. Back up config.toml and auth.json in that folder by copying each with .bak added to the name.
4. Edit config.toml and remove only the third-party API settings, leaving everything else as it is:
   - top-level model_provider, openai_base_url and chatgpt_base_url
   - every [model_providers.<name>] table
   - forced_login_method = "api"
   - model_provider inside each [profiles.<name>]; if the top-level profile points at such a profile, remove that line too
   - model, if it names a relay's own model rather than an OpenAI model, so Codex uses its default model
5. Check user and system environment variables for OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_API_BASE, CODEX_API_KEY and CODEX_ACCESS_TOKEN. List any you find and remove them once I confirm. On Windows also check the PowerShell profile ($PROFILE); on macOS and Linux check ~/.zshrc, ~/.bashrc and ~/.profile.
6. If the codex command runs, run codex logout; otherwise delete auth.json in the Codex folder.
7. Tell me what you changed and where the backups are. Then remind me to quit Codex and the ChatGPT desktop app completely, reopen them, sign in with my ChatGPT account (codex login on the command line), and run codex login status, which should say I'm logged in with ChatGPT.

What it changes

  • The model_provider, openai_base_url and [model_providers] settings in config.toml that send Codex to a third-party API.
  • forced_login_method = "api", which forces API key sign-in.
  • Environment variables such as OPENAI_API_KEY and OPENAI_BASE_URL, where a relay's key and address are often set.
  • The saved login in auth.json, which also holds the third-party key.

OpenAI: Authentication

OpenAI: Configuration Reference

Signing in afterwards

  1. Quit Codex and the ChatGPT desktop app completely, including the tray icon, then open it again.
  2. In the desktop app click Continue to sign in; on the command line run codex login. Sign in to your ChatGPT account in the browser.
  3. Run codex login status. When it says you're logged in with ChatGPT, you're done.

No official Codex yet?

Codex for Windows comes from the Microsoft Store, published by OpenAI.

Download Codex for Windows →

Common questions

Will I lose my chats?

No. Only the API lines in config.toml, the environment variables and the saved login change. Chats, skills, MCP and other settings stay, and the files are backed up first.

Codex still calls the third-party API. What now?

Check whether CC Switch or a similar tool is still running; it writes the settings back. Environment variable changes apply once you reopen the terminal and Codex.

After signing in, it says I'm out of usage?

Codex uses the allowance of your ChatGPT plan. When it runs out, add Codex credits or upgrade to Pro.

Four things we promise

  • No passwordWe never ask for your password or verification code. You paste the Session only on your own order page.
  • Session not stored in the databaseThe Session is used only to activate this order and is not stored in the database. Logging out of all devices in ChatGPT revokes it.
  • Full refund if it can't be activatedIf we can't activate your plan, the full amount goes back to the way you paid.
  • Lost within 30 days? Restored freeIf the plan stops working within 30 days of activation for reasons not on your side, we restore it free or refund the remaining days.

Problems caused by your own account, such as sharing or reselling it, are not covered; the Terms of Service decide. Terms of Service →

Activation success, last 7 days
100%
Median Plus delivery, last 7 days
1′39″

From real orders · updated 2026-11-08 20:20 UTC · Service status →

No ChatGPT plan yet?

Plus $23.90/month · on your own account · full refund if it fails