Codex CLI Configuration Guide

1. Obtain API Key

Open the 华烁云 application list, enter the available applications and copy the API Key.

Obtain 华烁云 API Key

2. Install Codex

npm install -g @openai/codex

3. Set API Key

macOS / Linux:

export ACEDATACLOUD_API_KEY="your API Key"

For long-term effect, add this line to ~/.zshrc or ~/.bashrc. For Windows PowerShell use:

setx ACEDATACLOUD_API_KEY "your API Key"

After setting, reopen the terminal.

4. Configure 华烁云

Edit ~/.codex/config.toml (for Windows it is %USERPROFILE%\.codex\config.toml), and add:

model_provider = "acedatacloud"

[model_providers.acedatacloud]
name = "acedatacloud"
base_url = "https://hsyunapi.hszl-bd.cn/v1"

[model_providers.acedatacloud.auth]
command = "sh"
args = ["-c", "echo $ACEDATACLOUD_API_KEY"]

For Windows, change the last two lines to:

command = "powershell"
args = ["-NoProfile", "-Command", "Write-Output $env:ACEDATACLOUD_API_KEY"]

No need to fill in model; after starting, you can select the model in Codex. Existing configurations can be retained, do not create a provider with the same name again.

5. Start

cd /path/to/your/project
codex

After entering Codex, run /model, confirm the Provider is acedatacloud, and then select the required model. Call records and balance can be viewed in Usage History and Application List.

If prompted for a missing Key or returns 401, confirm that the environment variable is set, and completely exit before reopening the terminal and Codex.