Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Setup guide - Documented by GLM

Use GLM in Codex CLI

Z.ai documents running Codex CLI (and the Codex app) on GLM-5.3 via its dedicated OpenAI Responses endpoint https://api.z.ai/api/v1, using a ~/.codex/models.json model catalog plus a custom model_providers.ZAI block in ~/.codex/config.toml.

Last verified 6 steps3 official sources

Steps

  1. Step 1.

    Install Codex CLI and verify the install.

    Terminal
    npm install -g @openai/codex
    codex --version
  2. Step 2.

    Get a GLM Coding Plan API key (Personal Coding Plan > Plan Overview, or Team Coding Plan > My Plan).

  3. Step 3.

    Create ~/.codex/models.json with Z.ai's GLM model catalog (copied verbatim from Z.ai's Codex page).

    JSON
    {
        "models": [
            {
                "slug": "glm-5.3",
                "display_name": "glm-5.3",
                "description": "Z.ai's latest flagship model",
                "default_reasoning_level": "max",
                "supported_reasoning_levels": [
                    {
                        "effort": "low",
                        "description": "Light reasoning"
                    },
                    {
                        "effort": "high",
                        "description": "Enhanced reasoning"
                    },
                    {
                        "effort": "max",
                        "description": "Deep reasoning"
                    }
                ],
                "shell_type": "shell_command",
                "visibility": "list",
                "supported_in_api": true,
                "priority": 0,
                "base_instructions": "",
                "supports_reasoning_summaries": true,
                "default_reasoning_summary": "none",
                "support_verbosity": false,
                "apply_patch_tool_type": "freeform",
                "truncation_policy": {
                    "mode": "bytes",
                    "limit": 10000
                },
                "context_window": 1048576,
                "max_context_window": 1048576,
                "effective_context_window_percent": 95,
                "supports_parallel_tool_calls": true,
                "experimental_supported_tools": [],
                "input_modalities": [
                    "text"
                ]
            }
        ]
    }
  4. Step 4.

    Write ~/.codex/config.toml (Windows: C:\Users\<YourUsername>\.codex\config.toml), replacing <Your API Key>.

    TOML
    model_provider = "ZAI"
    model = "glm-5.3"
    model_reasoning_effort = "max"
    model_catalog_json = "~/.codex/models.json"
    
    [model_providers.ZAI]
    name = "ZAI"
    base_url = "https://api.z.ai/api/v1"
    experimental_bearer_token = "<Your API Key>"
    wire_api = "responses"
  5. Step 5.

    Alternatively, run Z.ai's Coding Tool Helper to configure Codex automatically.

    Terminal
    npx @z_ai/coding-helper
  6. Step 6.

    Open a new terminal (or restart the Codex app) and start Codex.

    Terminal
    codex

Caveats

  • Z.ai warns Codex requires the dedicated OpenAI Responses endpoint https://api.z.ai/api/v1, and wire_api must be set to responses.
  • The key is stored in config.toml as experimental_bearer_token (no env var is documented by Z.ai for Codex).
  • Z.ai's models.json only declares glm-5.3; other models must be added to models.json before setting model to them.
  • Codex's own docs were not checked for model_catalog_json; the config is copied from Z.ai's page only.
  • GLM Coding Plan is limited to Z.ai's officially supported tools (Codex is listed). Coding Plan and Standard API keys are separate since 2026-10-16.

FAQ

How do I use GLM in Codex CLI?

Z.ai documents running Codex CLI (and the Codex app) on GLM-5.3 via its dedicated OpenAI Responses endpoint https://api.z.ai/api/v1, using a ~/.codex/models.json model catalog plus a custom model_providers.ZAI block in ~/.codex/config.toml.

Which GLM model ids work in Codex CLI?

The official docs read for this guide list glm-5.3. Requests go to https://api.z.ai/api/v1.

Is this an official GLM and Codex CLI setup?

GLM documents this setup in its own docs. It was last checked against 3 official pages on October 17, 2026.

Sources

Last verified against 3 official pages.

Newsletter

New models, set up the day they ship

One email per week. New model releases, the coding tools that support them and how to wire them up.