Codex CLI Custom API Endpoint: Choosing and Configuring a Relay

Codex CLI is OpenAI's command-line coding assistant, and plenty of developers reach it through a relay instead of official access. Of the 551 relays we currently track, 316 offer Codex-related models or a dedicated group — this article covers what to check before choosing one and how to point Codex at it.

What Codex CLI is, and why route it through a relay

Codex CLI is a terminal-based coding assistant that can read and write local code, run commands, and help debug. It calls OpenAI's model API, and going through official channels usually means needing an international payment method plus dealing with connectivity that isn't always reliable from every region. A relay strips that barrier out — pay however you already can, get a base_url and a key, add a short provider entry to your Codex config, and you're connected. That's also why, for a lot of people, a relay is their first real introduction to this whole space — they just wanted Codex CLI to work.

One thing specific to Codex

Many relays run a dedicated "Codex-only" group that's usually priced better than the general GPT group — but that group typically only recognizes requests from the official Codex CLI client (the backend checks request signatures like the User-Agent header). Cursor, Cline, and other third-party editors hitting that same group will most likely error out or get rejected outright. Ask before you buy whether the group actually supports the client you plan to use — don't find out after you've already funded your account.

Codex CLI install: the official commands

OpenAI lists four ways to install Codex CLI in its Codex CLI documentation and in the openai/codex README. Pick one; they all give you the same codex command.

# macOS / Linux: standalone installer
curl -fsSL https://chatgpt.com/codex/install.sh | sh

# Windows (PowerShell): standalone installer
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

# npm
npm install -g @openai/codex

# Homebrew
brew install --cask codex

Then run codex in a project directory. On first launch the CLI offers to sign in with ChatGPT; the README says you can also use Codex with an API key, which needs additional setup. If you plan to use a relay, the next section is the part that matters: you skip the ChatGPT sign-in and define the relay as a custom provider in config.toml.

Codex config.toml: Codex CLI custom model provider configuration guide

To send codex-cli traffic through a relay, define the relay as a custom model provider in your user-level ~/.codex/config.toml and select it with model_provider. The provider entry takes a display name, the relay's base_url, and env_key, the name of the environment variable that holds your API key.

# ~/.codex/config.toml
model = "model-name-your-relay-serves"
model_provider = "myrelay"

[model_providers.myrelay]
name = "My relay"
base_url = "https://provider-domain/v1"
env_key = "MYRELAY_API_KEY"
export MYRELAY_API_KEY="your-key"

Add the export line to your shell's startup script (.zshrc or .bashrc) so it persists, then open a new terminal and run something simple, like asking Codex to summarize a local file, to confirm you get a normal response. Two details from OpenAI's configuration docs are worth knowing: responses (the OpenAI Responses API) is the only supported wire_api value, so the relay has to support that API and not only the older chat-completions format; and Codex ignores model_provider, model_providers and openai_base_url in a project-level .codex/config.toml (it prints a startup warning when it sees them), so define the provider in your user-level file.

If you only want to repoint the built-in OpenAI provider at a proxy or router, the docs also describe a top-level openai_base_urlsetting in the same file, so you don't need to define a new provider.

For the full field-by-field reference, see theconfig.toml field guide on codexreset.ai; for installing and upgrading Codex CLI, seecodexreset.ai.

Codex CLI update: how to upgrade to the latest version

Use the update command that matches how you installed it. These are the commands the official Codex CLI page gives for each method:

# macOS / Linux (standalone installer): run the installer again
curl -fsSL https://chatgpt.com/codex/install.sh | sh

# Windows (PowerShell): run the installer again
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

# npm
npm install -g @openai/codex

# Homebrew
brew upgrade --cask codex

The CLI reference also lists a codex update command, which it describes as checking for and applying an update when the installed release supports self-update. After upgrading, send one small request to confirm your relay provider entry in ~/.codex/config.toml still works.

Official sources used

What to check before choosing one

1

Does it clearly label a Codex group?

Some relays call out a distinct "Codex-only" or "Codex group," meaning they've done targeted work on that channel — often only recognizing the official CLI's request signature. Not having a labeled group doesn't necessarily mean it's unsupported, but it's worth asking before you sign up.

2

Is the pricing transparent?

Codex-related models can vary in price by several multiples depending on the channel group. Transparent providers will tell you whether a given price is a straight official pass-through or a subscription-slicing channel, so the price difference actually makes sense.

3

Can they explain where the channel comes from?

Ask support or check the docs — can they clearly explain what's backing this Codex group? Vague answers that just say "stable and reliable" without explaining the source are a reason to be cautious.

Our tracked data

We currently track 551 relays, of which 316 offer Codex-related models or a dedicated group, and a separate 170 run a dedicated Claude Code group. To see directly which providers support Codex and compare their pricing and channel sources, check theGPT-5.5 price comparison pageor use the filters on the homepage.

FAQ

Some relays list Codex in their model catalog, but it doesn't work in Cursor. Why?

Some relays' dedicated Codex groups only recognize requests from the official Codex CLI client (based on signals like the User-Agent header). A third-party editor or tool hitting that same endpoint may get rejected outright. This is a limitation of the channel itself, not a misconfiguration on your end — confirm which clients a group actually supports before you buy.

What does "316 relays support Codex" on this site actually mean?

It means that of the 551 relays we track, 316 list Codex-related models or a dedicated group in their catalog or docs, based on our own data collection. The exact scope and limitations of what each one supports still depend on that provider's own documentation.

How do I update Codex CLI after installing it with npm or Homebrew?

Per OpenAI's Codex CLI page, an npm install is updated by running npm install -g @openai/codex again, a Homebrew install with brew upgrade --cask codex, and the standalone installers by running the installer command again. The CLI reference also lists a codex update command for releases that support self-update. After upgrading, send one small request to confirm your relay still answers.

Is a Codex relay the same thing as a regular GPT relay?

The underlying interface is often shared (both are typically OpenAI-format compatible), but Codex-specific groups are usually configured or client-restricted for coding workloads specifically, which is why relays tend to list them separately — pricing and availability can differ from the general GPT group too.

GPT-5.5 pricingHow to connect and useChannel types explainedBrowse all relays