1. Quick Start Guides
AnyRoute English
  • AnyRoute User Guide
  • Frequently Asked Questions
  • AnyRoute Support Group
  • Supported Models
  • Environment Setup
    • Node.js Installation Guide
    • CC Switch Introduction
  • Quick Start Guides
    • Codex CLI Quick Start
    • Claude Code Quick Start
    • OpenClaw Quick Start
    • Hermes Quick Start
    • Cherry Studio Quick Start
    • Claude Desktop Quick Start
    • Codex Desktop Quick Start
    • GPT Image 2 Guide
    • Claude Code in VS Code
  • Advanced Guides
    • Personal AGENTS.md Global Rules
    • Claude Code and Codex Collaboration Guide
  1. Quick Start Guides

Codex Desktop Quick Start

This guide installs Codex Desktop and configures it to send model requests through AnyRoute.

Windows#

1. Install Codex Desktop#

Download Codex from the official OpenAI site or search for Codex in Microsoft Store.
Find Codex in Microsoft Store
Install Codex
Open Codex
Codex welcome screen
After the first launch, fully quit Codex, including its system-tray process. Configure the provider before reopening it.

2. Configure AnyRoute#

Option A: CC Switch (recommended)#

Download CC Switch from its GitHub Releases page.
In the Codex panel:
1.
Select Add provider.
2.
Choose the GPT/Codex provider type, not Claude.
3.
Enter the AnyRoute base URL and API key.
4.
Load the available models, select the required model, and save.
5.
Enable the provider and restart Codex.
Add a Codex provider
Choose the Codex provider type
Enter provider details
Load and save models

Option B: manual configuration#

Create the directory without deleting any existing Codex data:
New-Item -ItemType Directory -Force "$env:USERPROFILE\.codex" | Out-Null
Codex configuration directory
Create or update %USERPROFILE%\.codex\config.toml. Merge these settings with any existing configuration:
model_provider = "anyroute"
model = "gpt-5.6-sol"
model_reasoning_effort = "high"

[model_providers.anyroute]
name = "AnyRoute"
base_url = "https://cc.anyroute.io"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
Set the key as a user environment variable:
[System.Environment]::SetEnvironmentVariable(
  "OPENAI_API_KEY",
  "YOUR_API_KEY",
  [System.EnvironmentVariableTarget]::User
)
The key is stored in the user's environment and can be read by processes running as that user. Do not use this approach on a shared account; use CC Switch or another secure credential-management method instead.
Fully restart Codex after changing the provider.
Test Codex Desktop
Successful response

macOS#

The provider settings are the same. The configuration directory is:
~/.codex
Open it in Finder with:
Preserve existing config.toml, authentication data, history, logs, and caches.

Optional: retain official sign-in for official app features#

Some Codex Desktop features may require an official ChatGPT/Codex sign-in even when model requests are routed through AnyRoute. CC Switch 3.16.1 or later includes an option to retain the official sign-in while switching a third-party provider.
Prerequisites:
CC Switch 3.16.2 or later
Codex Desktop, and preferably Codex CLI, installed
An official ChatGPT/Codex account
An AnyRoute API key
Never copy or share ~/.codex/auth.json. It can contain official sign-in tokens and must be treated as a secret.

1. Complete an official sign-in#

1.
In CC Switch, select OpenAI Official in the Codex panel.
2.
Start Codex and complete the official sign-in flow once.
3.
Confirm that Codex recognizes the official account.
Select OpenAI Official

2. Enable sign-in retention#

In CC Switch, open:
Settings → General → Codex App Enhancement
Enable Retain official sign-in when switching to a third-party provider.
This keeps the official authentication state while changing the model-provider configuration.

3. Add and enable AnyRoute#

Use:
Base URL: https://cc.anyroute.io
API key: a Codex-compatible AnyRoute key
Add AnyRoute to the Codex panel
Enable the provider and restart Codex so that it reloads config.toml and the model catalog.

Expected behavior#

Codex may continue to display the official account.
Model traffic follows the active CC Switch provider and Codex provider configuration.
Verify the actual billing provider using AnyRoute usage records, not the account label shown in Codex.
Restart Codex after changing a model mapping.
CC Switch Codex enhancement

Troubleshooting#

Codex still displays the official account#

This is expected when official sign-in retention is enabled. Confirm the active provider in CC Switch and verify requests in AnyRoute usage records.

The model list did not change#

Fully quit and restart Codex.

HTTP 401#

Confirm that the AnyRoute key is active, assigned to a Codex-compatible group, and available to the Codex process.

HTTP 404 or incorrect model list#

Confirm the base URL and model ID. If CC Switch uses local routing for the selected compatibility mode, verify that its routing service is running.
For CLI-specific setup and troubleshooting, see Codex CLI Quick Start.

Join AnyRoute WeChat Group

To get support for AnyRoute

scan QR code
Modified at 2026-07-24 19:04:33
Previous
Claude Desktop Quick Start
Next
GPT Image 2 Guide
Built with