Skip to content

Codex CLI setup

Install using the official Codex quickstart. Prepare a WuDi key and a suitable model. Codex uses Responses; a successful Chat Completions request alone does not verify compatibility. Confirm a compatible route before using this configuration.

macOS or Linux:

Terminal window
export WUDI_API_KEY='YOUR_WUDI_API_KEY'

Windows PowerShell:

Terminal window
$env:WUDI_API_KEY = 'YOUR_WUDI_API_KEY'

Back up ~/.codex/config.toml. On Windows, the user configuration normally lives at %USERPROFILE%\\.codex\\config.toml. Merge the following without declaring the same TOML table twice:

model = "gpt-5.6-sol"
model_provider = "wudi"
[model_providers.wudi]
name = "WuDi API"
base_url = "https://wudiapi.com/v1"
env_key = "WUDI_API_KEY"
wire_api = "responses"
requires_openai_auth = false

env_key is the environment variable’s name, not the actual secret. The model ID must match your key’s access. Do not add unverified reasoning settings, WebSockets or experimental options.

Run codex from the terminal containing the environment variable. Send a short request in a new session and check the model and group in the usage log. A desktop-launched application may not inherit a terminal’s temporary variables; see desktop setup.

Project-level configuration, command-line flags or a selected profile may override user settings. If an old model appears, check effective configuration rather than repeatedly creating keys. Duplicate tables, typographic quotes or misplaced top-level fields can cause parse errors.

For Responses errors, test the minimal request. A 404 can indicate an incorrect path or an unavailable protocol. Read the response details for a 400. Hosted features need separate support; replacing the Responses path with a chat path does not provide it.

Exit Codex and restore the backup, or remove the added provider and restore the previous model_provider. You do not need to delete the entire user configuration directory.

Reference: official configuration reference.