Codex for VS Code Configuration Guide

The Codex VS Code extension shares ~/.codex/config.toml with the Codex CLI.

1. Obtain API Key

Open the AI 聚合|元宪智能 application list, enter the available application, and copy the API Key.

Obtain AI 聚合|元宪智能 API Key

2. Install Extension

Install Codex – OpenAI's coding agent published by OpenAI from the VS Code extension marketplace, or run:

code --install-extension openai.chatgpt

3. Set API Key

macOS / Linux:

export ACEDATACLOUD_API_KEY="your API Key"

To make it permanent, add this line to ~/.zshrc or ~/.bashrc. For Windows PowerShell, use:

setx ACEDATACLOUD_API_KEY "your API Key"

4. Configure AI 聚合|元宪智能

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.yxai-tech.top/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; you can select the model in the Codex panel.

5. Restart and Verify

Completely exit and reopen VS Code, then open the Codex panel. Run /model, confirm that the Provider is acedatacloud, and then send a simple message; the call records can be viewed in Usage History.

If the extension cannot read the Key, please start VS Code from a terminal where the environment variable is set, or set the system-level environment variable and then restart VS Code. Remote SSH, WSL, and Dev Container need to be configured in the environment where the extension is actually running.