Use with Codex

[!WARNING] We recommend CC Switch for managing and switching Codex provider configurations — no manual environment-variable or config-file editing needed.

[!INFO] This page is for the official Codex CLI (command line). If you use the Codex desktop app with the third-party enhancement tool Codex++, see Use with Codex++ instead.

Codex CLI supports adding custom model providers through its config file. This is a good fit for saving yylx.io as a standalone provider you can then select directly inside Codex.

[!INFO] The config file suits long-term use. For a quick test, you can just set the environment variable and specify the model with a command-line flag.

What you need

Field Value
Provider ID yylx
Provider Name yylx.io
Base URL https://app.yylx.io/v1
API Key environment variable YYLX_API_KEY
Model A model name from the console's model list

First, open the "API Keys" page in the yylx.io console and create or pick a Key dedicated to Codex. Including codex in the name makes usage easier to trace later.

Create a Codex-specific Key on the API Keys page

Set the API Key

Set the Key in your terminal first:

export YYLX_API_KEY="sk-your-api-key"

For long-term use, add it to ~/.zshrc or ~/.bashrc.

If you added it to a shell config file, remember to run:

source ~/.zshrc

Confirm the current terminal can read the variable:

echo $YYLX_API_KEY

Any non-empty output is fine — don't paste the full Key into public chats or issues.

Configure the Codex provider

Edit ~/.codex/config.toml and add:

model = "your-model-name"
model_provider = "yylx"

[model_providers.yylx]
name = "yylx.io"
base_url = "https://app.yylx.io/v1"
env_key = "YYLX_API_KEY"
wire_api = "responses"

Replace your-model-name with a model name shown in the yylx.io console.

Field reference

Field Description
model_provider The provider ID used by default
base_url The yylx.io OpenAI-compatible address
env_key The environment variable Codex reads the API Key from
wire_api The API style Codex uses; follow what your Codex version supports

[!TIP] If your Codex version's config fields differ slightly from the example, keep the same core pieces: provider ID, Base URL, environment variable name, and model name. After upgrading Codex, it's also worth re-checking the config file format.

Launch

codex

To switch models temporarily, use Codex's launch flags or its in-session model picker. On first launch, start with a lightweight request — for example, ask the model to print its configured model name or a one-line summary — to confirm the provider is active.

Verify requests reach yylx.io

Check both sides:

Where What to look for
Codex terminal Normal responses; any authentication or unknown-model errors
yylx.io usage log Whether the Codex request you just made appears

If nothing shows up in the yylx.io usage log, Codex usually isn't using the yylx provider, or the current terminal can't read YYLX_API_KEY.

Troubleshooting

For authentication errors, first confirm the terminal can read the variable:

echo $YYLX_API_KEY

For unknown-model errors, make sure the model field matches the console name exactly.

For network or API-format errors, check that base_url stops at /v1 — not /v1/chat/completions or /v1/responses.

[!TIP] If you switch between providers often, let CC Switch manage the yylx.io configuration to cut down on manual edits to ~/.codex/config.toml.

results matching ""

    No results matching ""