Step 1: Install Codex
Codex is available in two forms: the Codex CLI that runs in your terminal, and the desktop Codex app. Choose whichever fits your workflow.- Install the Codex App
- Install Codex CLI
- Visit the ChatGPT download page and download the installer for your operating system.
- Follow the system prompts to complete the installation and launch the app.
- If you already have Codex CLI installed, you can also launch the desktop app directly from the terminal:
Step 2: Configure GLM Coding Plan
1
Register an Account
Visit the Z.AI Open Platform, click the “Register/Login” button in the top right, and follow the prompts to complete the registration process.
2
Get Your API Key
- Individual Plan users can create an API Key under Individual Coding Plan > Plan Overview.
- Team Plan members can obtain their API Key under Team Coding Plan > My Plan. The Team Plan Key is not interchangeable with other Z.AI API Keys. To use your Team Plan quota, make sure to use the Team Plan Key.
3
Configure the Model and API Key
Codex connects via the OpenAI Responses protocol, using the endpoint
https://api.z.ai/api/v1.- Manual Configuration
Supported on macOS & Linux & Windows. Note that config file paths differ by system. Make sure the file format is correct after editing.
1. Create the Model Catalog File
Create~/.codex/models.json to declare GLM model metadata to Codex. If the file or directory does not exist, create it first.Copy the following content entirely into ~/.codex/models.json:2. Configure the API Key and Model
Locate the Codex configuration file at the following path. Create it if it does not exist:- macOS/Linux:
~/.codex/config.toml - Windows:
C:\Users\<YourUsername>\.codex\config.toml
~/.codex/config.toml, replacing <Your API Key> with the API Key you obtained in the previous step:wire_apimust be set toresponses.model_catalog_jsonpoints to the model metadata file created in the previous step.modelcan be switched toglm-5.3or any other model declared inmodels.jsonas needed.
After a successful configuration, restart the app for the changes to take effect.
Step 3: Start Using Codex
Once configured, restart yourCodex app or open a new terminal and run the codex command to get started.
Step 4: FAQ
Manual Configuration Not Taking Effect
- Close all Codex windows, open a new terminal window, and run
codexagain to start. - Confirm that
~/.codex/models.jsonexists and is valid JSON. You can use an online JSON validator to check. - Confirm that the
model_catalog_jsonpath in~/.codex/config.tomlis correct. - Confirm that
experimental_bearer_tokenhas been replaced with your actual API Key. - Confirm that the TOML format of the configuration file is correct—check field names, quotes, and brackets for completeness.