Codex CLI Configuration Guide

1. Obtain API Key

Open the 费思量-API application list, enter the available applications and copy the API Key.

Obtain 费思量-API 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 费思量-API

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://api.fesilent.com/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.