---
title: Used a relay or CC Switch with Codex? Switch back to the ChatGPT sign-in | Pay2GPT
description: Copy one prompt for an AI assistant to reset Codex's API settings, environment variables and saved login, then sign in with ChatGPT. No reinstall.
url: https://pay2gpt.com/en/guide/codex-official-login.md
canonical: https://pay2gpt.com/en/guide/codex-official-login
locale: en
updated: '2026-11-09'
site: Pay2GPT
image: https://pay2gpt.com/assets/opengraph-8c4ca537.png
alternates:
  en: https://pay2gpt.com/en/guide/codex-official-login
  zh-CN: https://pay2gpt.com/guide/codex-official-login
  ru: https://ru.pay2gpt.com/guide/codex-official-login
  x-default: https://pay2gpt.com/guide/codex-official-login
---

> HTML version: https://pay2gpt.com/en/guide/codex-official-login
> Site index for agents: https://pay2gpt.com/en/llms.txt

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

Codex · 3 min read · Updated 2026-11-09

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.

## Copy the prompt for an AI assistant

```text
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](https://learn.chatgpt.com/docs/auth)

[OpenAI: Configuration Reference](https://learn.chatgpt.com/docs/config-file/config-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 →](https://pay2gpt.com/en/guide/codex-windows.md)

## 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.

## Related guides

- [Codex for Windows download: the official Microsoft Store package](https://pay2gpt.com/en/guide/codex-windows.md)
- [Codex usage limit reached? 3 ways to keep going](https://pay2gpt.com/en/guide/codex-usage-limit.md)

## Four things we promise

- **No password** — We never ask for your password or verification code. You paste the Session only on your own order page.
- **Session not stored in the database** — The 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 activated** — If we can't activate your plan, the full amount goes back to the way you paid.
- **Lost within 30 days? Restored free** — If 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 →](https://pay2gpt.com/en/terms.md)

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

From real orders · updated 2026-11-08 21:13 UTC · [Service status →](https://pay2gpt.com/en/status.md)


**No ChatGPT plan yet?** Plus $23.90/month · on your own account · full refund if it fails [Get Plus](https://pay2gpt.com/en/checkout?plan=plus) · [Order in Telegram](https://t.me/Pay2GPTBot?start=buy_plus)

[Go to the Help Center](https://pay2gpt.com/en/help.md)

## Guide contents

- [How to copy your ChatGPT Session, with pictures](https://pay2gpt.com/en/guide/session.md)
- [How to activate ChatGPT Plus or Pro after paying: 3 steps](https://pay2gpt.com/en/guide/activate.md)
- [Pay with USDT](https://pay2gpt.com/en/guide/usdt.md)
- [How to use a promo code](https://pay2gpt.com/en/guide/promo.md)
- [How to pay for ChatGPT Plus with Alipay](https://pay2gpt.com/en/guide/alipay.md)
- [How to pay for ChatGPT Plus without a credit card: 5 ways compared](https://pay2gpt.com/en/guide/compare.md)
- [Is it safe to give Pay2GPT my Session?](https://pay2gpt.com/en/guide/safe.md)
- [ChatGPT Plus payment declined? Why your card fails and how to fix it](https://pay2gpt.com/en/guide/card-declined.md)
- [Plus or Pro?](https://pay2gpt.com/en/guide/choose.md)
- [A 6-point checklist for a trustworthy top-up](https://pay2gpt.com/en/guide/checklist.md)
- [ChatGPT Pro top-up, which tier to choose](https://pay2gpt.com/en/guide/pro.md)
- [Codex usage limit reached? 3 ways to keep going](https://pay2gpt.com/en/guide/codex-usage-limit.md)
- [Codex for Windows download: the official Microsoft Store package](https://pay2gpt.com/en/guide/codex-windows.md)
- [Used a relay or CC Switch with Codex? Switch back to the ChatGPT sign-in](https://pay2gpt.com/en/guide/codex-official-login.md)
- [ChatGPT payment declined in Pakistan? Pay for Plus](https://pay2gpt.com/en/guide/pakistan.md)
- [ChatGPT payment declined in Nigeria? Pay for Plus](https://pay2gpt.com/en/guide/nigeria.md)
- [What is a personal agent? ChatGPT dots explained: features, plans and limits](https://pay2gpt.com/en/guide/personal-agent.md)
- [GPT-6.1 Terra: what's new, API pricing, and which ChatGPT plans get it](https://pay2gpt.com/en/guide/gpt-6-1-terra.md)
- [ChatGPT Images 2.6: GIFs, reference images, Flare vs Sunburst, and API pricing](https://pay2gpt.com/en/guide/chatgpt-images-2-6.md)
- [CapCut plugin for ChatGPT: what it does, release date, plans and how to install it](https://pay2gpt.com/en/guide/capcut-chatgpt.md)
- [Does ChatGPT have a referral program? Official invites vs. earning per referral](https://pay2gpt.com/en/guide/chatgpt-referral.md)
- [Codex asks you to verify a phone number? What to do when your number doesn't work](https://pay2gpt.com/en/guide/codex-phone-verification.md)
- [OpenAI verification code not received? Why ChatGPT and Codex texts don't arrive](https://pay2gpt.com/en/guide/openai-sms-code-not-received.md)
- [Which phone numbers can verify ChatGPT and OpenAI? Countries, VoIP and virtual numbers](https://pay2gpt.com/en/guide/chatgpt-phone-number.md)
- [SMS verification for ChatGPT: why virtual numbers get rejected and how to choose a service](https://pay2gpt.com/en/guide/sms-verification-service.md)

---

Pay2GPT is a third-party service and is not affiliated with OpenAI.

- [Pay2GPT](https://pay2gpt.com/en/.md)
- [Guides](https://pay2gpt.com/en/guide.md)
- [Help](https://pay2gpt.com/en/help.md)
- [Service status](https://pay2gpt.com/en/status.md)
- [Orders](https://pay2gpt.com/en/orders)
- [Get started](https://pay2gpt.com/en/checkout?plan=plus)
- [Terms of Service](https://pay2gpt.com/en/terms.md)
- [Privacy Policy](https://pay2gpt.com/en/privacy.md)
- [Telegram](https://t.me/Pay2GPT_support)
- [Trustpilot](https://www.trustpilot.com/review/pay2gpt.com)
- [Site index for agents](https://pay2gpt.com/en/llms.txt)

Contact: [support@pay2gpt.com](mailto:support@pay2gpt.com)

## Structured data

```json
{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Organization",
      "@id": "https://pay2gpt.com/#organization",
      "name": "Pay2GPT",
      "url": "https://pay2gpt.com/en",
      "logo": {
        "@type": "ImageObject",
        "url": "https://pay2gpt.com/icon-512.png",
        "width": 512,
        "height": 512
      },
      "description": "ChatGPT Plus, Pro and Go top-up on your own account. Order on your own and follow every step. Full refund if activation fails, fixed free if it drops within 30 days.",
      "contactPoint": {
        "@type": "ContactPoint",
        "contactType": "customer support",
        "url": "https://pay2gpt.com/en/help",
        "email": "support@pay2gpt.com",
        "availableLanguage": [
          "en",
          "zh-CN",
          "es",
          "ja",
          "de",
          "fr",
          "pt-BR",
          "ko",
          "it",
          "nl",
          "pl",
          "ru",
          "tr",
          "zh-TW",
          "zh-HK",
          "ar"
        ]
      }
    },
    {
      "@type": "BreadcrumbList",
      "itemListElement": [
        {
          "@type": "ListItem",
          "position": 1,
          "name": "Pay2GPT",
          "item": "https://pay2gpt.com/en"
        },
        {
          "@type": "ListItem",
          "position": 2,
          "name": "Guides",
          "item": "https://pay2gpt.com/en/guide"
        },
        {
          "@type": "ListItem",
          "position": 3,
          "name": "Used a relay or CC Switch with Codex? Switch back to the ChatGPT sign-in",
          "item": "https://pay2gpt.com/en/guide/codex-official-login"
        }
      ]
    },
    {
      "@type": "TechArticle",
      "@id": "https://pay2gpt.com/en/guide/codex-official-login#article",
      "headline": "Used a relay or CC Switch with Codex? Switch back to the ChatGPT sign-in",
      "description": "Copy one prompt for an AI assistant to reset Codex's API settings, environment variables and saved login, then sign in with ChatGPT. No reinstall.",
      "inLanguage": "en",
      "mainEntityOfPage": "https://pay2gpt.com/en/guide/codex-official-login",
      "dateModified": "2026-11-09",
      "author": {
        "@id": "https://pay2gpt.com/#organization"
      },
      "publisher": {
        "@id": "https://pay2gpt.com/#organization"
      }
    },
    {
      "@type": "FAQPage",
      "@id": "https://pay2gpt.com/en/guide/codex-official-login#faq",
      "inLanguage": "en",
      "mainEntity": [
        {
          "@type": "Question",
          "name": "Will I lose my chats?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "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."
          }
        },
        {
          "@type": "Question",
          "name": "Codex still calls the third-party API. What now?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "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."
          }
        },
        {
          "@type": "Question",
          "name": "After signing in, it says I'm out of usage?",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Codex uses the allowance of your ChatGPT plan. When it runs out, add Codex credits or upgrade to Pro."
          }
        }
      ]
    }
  ]
}
```
