> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llmeasy.ru/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I keep my official Codex login and session history while using a third-party API?

> Use CC Switch with a third-party API or custom model while keeping the official Codex login, plugins, Remote Control, and a unified session history.

You can use a third-party API or custom model without losing your official Codex login. Turn on two Codex App Enhancements in CC Switch to keep official plugins, Remote Control, and a unified session history.

## Before you begin

1. Use CC Switch `v3.16.1` or later.
2. Sign in to Codex once with your official ChatGPT / Codex account.
3. Follow the [Codex CLI steps in the CC Switch setup guide](/en/ai-tools/cc-switch#codex-cli) to add and enable your third-party API provider or custom model in CC Switch.

<Warning>
  Do not share API Keys, login tokens, or other authentication data in screenshots, chats, issues, or logs.
</Warning>

## Enable both Codex App Enhancements

In CC Switch, open **Settings → General → Codex App Enhancements** and turn on both switches:

1. **Keep official login when switching third-party providers**
2. **Unified Codex session history**

<Frame>
  <img src="https://mintcdn.com/bettertoken/rrfORMaXOChM0PZp/images/codex-official-login-state/cc-switch-codex-app-enhancements.png?fit=max&auto=format&n=rrfORMaXOChM0PZp&q=85&s=f2e869491802bac17c886f78ac44b50e" alt="CC Switch Codex App Enhancements with Keep official login and Unified Codex session history enabled." style={{ borderRadius: '0.5rem' }} width="2000" height="1300" data-path="images/codex-official-login-state/cc-switch-codex-app-enhancements.png" />
</Frame>

### Keep the official login, plugins, and Remote Control

**Keep official login when switching third-party providers** keeps the official Codex login when you switch to a third-party API provider or custom model.

Model requests still use the provider currently selected in CC Switch, while Codex App can continue to use features that require the official login, including official plugins and Remote Control.

For detailed steps, see the CC Switch guide: [Keep Codex Remote Control and official plugins while using a third-party API](https://github.com/farion1231/cc-switch/blob/main/docs/guides/codex-official-auth-preservation-guide-zh.md).

### View official and third-party sessions together

**Unified Codex session history** shows sessions created with the official subscription and third-party providers in one history list.

When you enable it, you can choose whether to move existing official sessions into that list. CC Switch automatically backs up the original sessions before migration.

For detailed steps, see the CC Switch guide: [Unified Codex session history](https://github.com/farion1231/cc-switch/blob/main/docs/guides/codex-unified-session-history-guide-zh.md).

## Restart Codex

After turning on both switches, fully quit and restart Codex. Codex reloads the current CC Switch configuration and the unified session history after restarting.

## Confirm that the setup works

After restarting, confirm the following:

1. Codex still shows your official account login.
2. Official plugins or Remote Control work normally.
3. CC Switch has your third-party API provider or custom model selected.
4. A test message returns normally.

<Note>
  A unified history lets you view sessions in one place, but it does not guarantee that an existing session can continue across providers. Resume a session with the provider that created it whenever possible. For another provider, start a new session.
</Note>

## Manual setup

Manual setup is for advanced users who are comfortable editing local Codex files. Most users should use CC Switch first.

<Steps>
  <Step title="Keep the official Codex login">
    Sign in to your official ChatGPT / Codex account in Codex App or Codex CLI first, then confirm that Remote Control or plugins work.

    Keep the content generated by your official login in `~/.codex/auth.json`. Do not copy, sync, or share its tokens.
  </Step>

  <Step title="Edit config.toml">
    Open `~/.codex/config.toml`, then add or merge this provider configuration:

    ```toml theme={null}
    model_provider = "custom"
    model = "gpt-5.5"
    review_model = "gpt-5.4"
    model_reasoning_effort = "high"
    model_context_window = 1000000
    model_auto_compact_token_limit = 900000
    windows_wsl_setup_acknowledged = true

    [model_providers]
    [model_providers.custom]
    name = "LLM Easy"
    base_url = "https://www.llmeasy.ru/v1"
    wire_api = "responses"
    requires_openai_auth = true
    experimental_bearer_token = "YOUR_API_KEY"
    request_max_retries = 4
    stream_max_retries = 8
    stream_idle_timeout_ms = 300000
    supports_websockets = false
    ```

    Replace `YOUR_API_KEY` with your LLMEasy API Key. `requires_openai_auth = true` keeps the official login, while `experimental_bearer_token` sends third-party API requests.
  </Step>

  <Step title="Restart and verify">
    Fully quit and restart Codex. Confirm that the official login remains, Remote Control or plugins open, and a test message returns normally.

    If the model is unavailable, confirm that `model` is from the **Codex group** in the <a href={"https://www.llmeasy.ru/pricing"}>model plaza</a>.
  </Step>
</Steps>
