Skip to main content
Codex is an AI coding agent from OpenAI that helps you write, review, and debug code. It is available both as a terminal tool and a desktop application.
Codex requires a dedicated OpenAI Responses protocol endpoint: https://api.z.ai/api/v1.

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.
  1. Visit the ChatGPT download page and download the installer for your operating system.
  2. Follow the system prompts to complete the installation and launch the app.
  3. 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

Keep your API Key safe. Do not share it with others or hard-code it directly in your code.
3

Configure the Model and API Key

Codex connects via the OpenAI Responses protocol, using the endpoint https://api.z.ai/api/v1.
Choose whichever configuration method below suits you.
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
Copy the following content entirely into ~/.codex/config.toml, replacing <Your API Key> with the API Key you obtained in the previous step:
  • wire_api must be set to responses.
  • model_catalog_json points to the model metadata file created in the previous step.
  • model can be switched to glm-5.3 or any other model declared in models.json as needed.
After a successful configuration, restart the app for the changes to take effect.

Step 3: Start Using Codex

Once configured, restart your Codex 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 codex again to start.
  • Confirm that ~/.codex/models.json exists and is valid JSON. You can use an online JSON validator to check.
  • Confirm that the model_catalog_json path in ~/.codex/config.toml is correct.
  • Confirm that experimental_bearer_token has 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.