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
- Step 1.
Install Codex CLI and verify the install.
Terminalnpm install -g @openai/codex codex --version - Step 2.
Get a GLM Coding Plan API key (Personal Coding Plan > Plan Overview, or Team Coding Plan > My Plan).
- 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" ] } ] } - Step 4.
Write ~/.codex/config.toml (Windows: C:\Users\<YourUsername>\.codex\config.toml), replacing <Your API Key>.
TOMLmodel_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" - Step 5.
Alternatively, run Z.ai's Coding Tool Helper to configure Codex automatically.
Terminalnpx @z_ai/coding-helper - Step 6.
Open a new terminal (or restart the Codex app) and start Codex.
Terminalcodex
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.
More setup guides
Same tool, other providers
Related reading
- Codex Custom Model Providers: GLM-5.3, Mistral and OllamaCodex only speaks the Responses API now. Tested config.toml blocks for GLM-5.3, Mistral Large 4 through a gateway, local Ollama and an internal proxy.
- Anthropic's GLM-5.3 Cyber Report: The Numbers, the Backlash, and What Developers Should Take From ItAnthropic's GLM-5.3 cyber report: exploit numbers against Claude Mythos Preview, how its safeguards were stripped, the backlash, and the read for developers.
- GLM-5.3 Free and Cheap: Every Route and Price (October 2026)GLM-5.3 has no free hosted tier. Cheapest on October 9: Wafer via OpenRouter at $0.049/$3.39, Flash from $0.075/$0.25. Z.ai's promos ended October 7.
- Prime Agent: A Self-Improving Coding Harness Where Everything Is PythonPrime Agent is Prime Intellect's open-source coding harness with one tool, a persistent IPython kernel. How it works, its benchmarks, and Claude Code compared.
- Cloudflare Runs Kimi and GLM at Scale: FP8 KV Caches, INT4 Weights, and a Cache Safety NetCloudflare runs Kimi K2.6 and GLM 5.2 on Workers AI with FP8 KV caches, INT4 weights and a KV cache integrity check. What each technique buys on GPU fleets.
- Colibri: Run GLM 5.2 on a 32GB Laptop With Disk StreamingA solo developer built a 1,300-line C inference engine that runs the 744B GLM 5.2 model on consumer hardware by streaming routed experts from disk.
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.