Codex is an intelligent coding agent developed by OpenAI. Set up and use Alibaba Cloud Model Studio's Coding Plan with Codex.
The latest version of Codex no longer supports the Chat or Completions API. To use the Coding Plan, follow the instructions below to install and use an earlier version.
Install Codex
Install or update Node.js (v18.0 or later).
Run the following command in your terminal to install an older version of Codex that supports the Chat and Completions APIs, such as version 0.80.0.
npm install -g @openai/codex@0.80.0Verify the installation. If a version number is returned, the installation is successful.
codex --version
Configure Codex
Update the config file
Copy the following code block and paste it into your Codex config file:
~/.codex/config.toml. Select a supportedmodelfrom the list.NoteThe latest version of Codex no longer supports the Chat or Completions API. To use the Coding Plan, follow the instructions above to install an earlier version of Codex.
model_provider = "Model_Studio_Coding_Plan" model = "qwen3.5-plus" [model_providers.Model_Studio_Coding_Plan] name = "Model_Studio_Coding_Plan" base_url = "https://coding-intl.dashscope.aliyuncs.com/v1" env_key = "OPENAI_API_KEY" wire_api = "chat"Set the environment variable
Set the
OPENAI_API_KEYenvironment variable to your Coding Plan API Key.macOS
Run the following command in your terminal to check your default shell.
echo $SHELLSet the environment variable based on your shell type.
Zsh
# Replace YOUR_API_KEY with your Coding Plan API key echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.zshrcBash
# Replace YOUR_API_KEY with your Coding Plan API key echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.bash_profileApply the environment variable.
Zsh
source ~/.zshrcBash
source ~/.bash_profile
Windows
CMD
Run the following command in CMD to set the environment variable.
REM Replace YOUR_API_KEY with your Coding Plan API key setx OPENAI_API_KEY "YOUR_API_KEY"Open a new CMD window and verify the environment variable.
echo %OPENAI_API_KEY%
PowerShell
Run the following command in PowerShell to set the environment variable.
# Replace YOUR_API_KEY with your Coding Plan API key [Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "YOUR_API_KEY", [EnvironmentVariableTarget]::User)Open a new PowerShell window and verify the environment variable.
echo $env:OPENAI_API_KEY
Use Codex
Open a new terminal and start Codex.
codexSkip the update prompt.

Start a conversation.
