Codex

Codex is OpenAI's official agent that helps you write, review and ship code. It runs as a CLI, an IDE extension, a desktop app and in the cloud, works on several tasks in parallel, and reads and edits files, runs commands and checks the results on your machine.

Already have an account? Sign in

codelux.configExample
agent
codex
endpoint
codelux.io/v1/responses
route
anthropic / claude-sonnet-5
status
available
  • Codex
Codelux Gateway
  • claude-sonnet-5
  • claude-opus-5-5
  • gpt-6-sol
  • DeepSeek-V41-Flash
  • kimi-k3
  • glm-5.3
Example: Codex connects to Codelux Gateway at codelux.io/v1/responses and uses anthropic / claude-sonnet-5. The same agent can switch between claude-sonnet-5, claude-opus-5-5, gpt-6-sol, DeepSeek-V41-Flash, kimi-k3, glm-5.3 and more.

How to use Codex with Codelux

About 10 minutes: install Codex CLI → create a key in Portal → import it with CC-Switch (or edit config.toml) → start Codex.

1. Install Codex CLI

Use the official standalone installer, npm, or Homebrew.

Run the installer

Terminal
curl -fsSL https://chatgpt.com/codex/install.sh | sh

You can also download a platform archive from GitHub Releases (e.g. codex-aarch64-apple-darwin.tar.gz), rename the extracted file to codex and put it on your PATH.

Verify the installation

Open a new terminal and run the command below; it should print a version number:

Terminal
codex --version

2. Set Codelux as the provider

Codex providers live in ~/.codex/config.toml. CC-Switch can write it for you, or you can add it by hand.

Create a Codelux account and API key

  1. Go to Codelux Portal and create an account (existing users sign in).
  2. Pick a subscription plan or top up in Billing — any balance works for every agent.
  3. Open API Keys in the left menu and click Create New Key. Give it a name you will recognise, such as the agent's name.
  4. After it is created, copy the API key (starts with sk-) and the API base URL. The key is shown in full only once, so keep it somewhere safe.

Install CC-Switch

CC-Switch is an open-source (MIT) desktop app that manages API providers for Claude Code, Codex, Gemini CLI, OpenCode and more. It writes the configuration files for you, so you don't have to edit them by hand. Requirements: Windows 10+, macOS 12+, or Linux x86_64/ARM64 with glibc 2.35+ and WebKitGTK 4.1 (e.g. Ubuntu 22.04+, Debian 12+).

Install with Homebrew (recommended):

Terminal
brew install --cask cc-switch

Or download CC-Switch-v{version}-macOS.dmg from Releases. It is a Universal build signed and notarized by Apple, so it runs on both Apple Silicon and Intel Macs.

CC-Switch main window listing providers for Claude Code
CC-Switch main window: pick the app at the top, then enable a provider; the orange + button adds a new one.

Import Codelux into CC-Switch in one click

  1. Keep CC-Switch running (it registers the ccswitch:// link handler on first launch).
  2. In Portal, on the success page of the key you just created, find Import to desktop clients. It is only shown on desktop browsers.
  3. On the CC-Switch card, set Target app to Codex, then click Import.
  4. Your browser asks to open CC-Switch — allow it. CC-Switch shows a confirmation dialog with the provider name (Codelux), endpoint and key; confirm to add it.
  5. In CC-Switch, switch to Codex at the top and make sure the Codelux provider is enabled.

Prefer to add it by hand? In CC-Switch click the orange + → Custom, fill in Provider name (e.g. codelux.io), Website https://codelux.io, your API Key and the Request URL (the Codelux API base URL, no trailing slash), then click Add.

CC-Switch add provider form filled in for Codelux: provider name, website, API key and request URL
Adding Codelux manually in CC-Switch. For Claude Code the request URL is the host only, without a trailing slash.

The Portal import sets the default model to gpt-5.5, and CC-Switch writes the Codelux provider (Responses protocol) to ~/.codex/config.toml. Close and reopen your terminal after switching providers for Codex to pick it up.

(Optional) Edit config.toml by hand

Open (or create) the user config file and add:

OSFile
macOS / Linux~/.codex/config.toml
Windows%USERPROFILE%\.codex\config.toml
~/.codex/config.toml
model = "gpt-5.5"
model_provider = "codelux"

[model_providers.codelux]
name = "Codelux"
base_url = "https://codelux.io/v1"
env_key = "CODELUX_API_KEY"
wire_api = "responses"
  • model_provider points to the [model_providers.codelux] table below it.
  • base_url is the Codelux API base URL with /v1; Codex appends /responses.
  • env_key is the name of the environment variable that holds your key.
  • wire_api = "responses" makes Codex use the Responses API, which Codelux supports.

Then put the key in that environment variable (add it to your shell profile to keep it):

Terminal
echo 'export CODELUX_API_KEY=sk-your-codelux-key' >> ~/.zshrc
source ~/.zshrc

3. Start using Codex

Start Codex in your project, confirm it uses the Codelux provider, then switch models as needed.

Start and confirm the connection

Terminal
cd your-project
codex

You don't need Sign in with ChatGPT with a third-party provider. In the session, run /status to confirm the model and the Codelux provider, then send a test prompt.

Switch models

Run /model in a session, or choose a model at launch:

Terminal
codex --model gpt-5.5

To change the default, edit model in config.toml. Model IDs are listed in Portal → AI Hub.

Everyday commands

CommandWhat it does
/initCreate an AGENTS.md with project instructions
/modelSwitch model and reasoning effort
/statusShow the current model, provider and token usage
codex exec "..."Run a task non-interactively (scripts and CI)

See each request's model, tokens and charge in Portal → Logs.

FAQ

Codex still asks me to sign in with ChatGPT

Check that model_provider = "codelux" is at the top level of ~/.codex/config.toml (not inside a table) and that the environment variable named in env_key is set in the terminal you start Codex from.

I get a 401 or missing API key error

The variable in env_key is empty in this terminal, or the key was deleted. Run echo $CODELUX_API_KEY to check, then reopen the terminal.

I get a 404 error

base_url must end with /v1 (e.g. https://codelux.io/v1), not /v1/responses.

Can Codex use non-GPT models?

Yes. Set model or run /model with any model ID from Portal → AI Hub; Codelux handles the Responses API for it.

Official references