Skip to main content
Codex CLI supports custom model providers. Configure a user-level yelu provider to send Responses API requests to https://api.yelu.ai/v1 with your Yelu API key.
The configuration below uses gpt-5.4, a coding-capable model recognized by the Yelu gateway. Model access is account-specific; confirm availability with GET /v1/models.

Configuration at a glance

Unlike Claude Code, Codex requires the /v1 suffix because its provider base URL is the OpenAI-compatible API root.

macOS

1. Install Codex

Use the official standalone installer:
macOS
Homebrew and npm are also supported:

2. Set the key

macOS
The key remains available to processes started from this terminal and is not written to shell history. For persistent use, load it from macOS Keychain or another secret manager in your shell startup.

3. Create the provider configuration

Create ~/.codex/config.toml and add:
~/.codex/config.toml
Provider settings must be in the user-level file. Codex intentionally ignores model_provider and model_providers in a project-local .codex/config.toml.

Windows

Native PowerShell

Install Codex using the official Windows installer:
Windows PowerShell
Set the key for the current session without echoing it:
Windows PowerShell
Create %USERPROFILE%\.codex\config.toml:
Windows PowerShell
To make the key available in future terminals, use a Windows secret manager. If you choose a user environment variable for convenience, remember that it is stored as plain user configuration rather than in a dedicated secret vault. Native Codex on Windows uses the Windows sandbox. The default is appropriate for most projects; do not switch to unrestricted execution just to work around a project permission error.

WSL 2

Use WSL 2 when your repository and tools live in Linux:
Administrator PowerShell
Then install and configure Codex inside WSL:
WSL 2
Put the same TOML provider block in the WSL file ~/.codex/config.toml. The Windows and WSL Codex installations use separate home directories, keys, and configuration files. Keep WSL projects under ~/code instead of /mnt/c for better filesystem performance.

Verify the API and configuration

First confirm that the key can see the model:
Validate the local configuration and run a read-only smoke test from a Git repository:
Terminal
Inside an interactive session, run /status to confirm that the provider is yelu, the model is gpt-5.4, and the active directory is correct.

Safe defaults

  • Keep YELU_API_KEY in an environment variable or secret manager; never place the key directly in TOML.
  • Start unfamiliar repositories with --sandbox read-only or use /permissions before allowing edits.
  • Use workspace-write only when the task should modify the current workspace.
  • Review the diff and run tests before accepting generated changes.
  • Avoid --dangerously-bypass-approvals-and-sandbox on a normal workstation.

Troubleshooting

Next step

Continue with the Codex CLI examples for exploration, implementation, review, image input, and automation.

Official references

Last modified on July 13, 2026