Last updated

Codex GLM: Use GLM-5.2 in Codex

This guide shows you how to add GLM models — GLM-5.2 and GLM-5-Turbo — to the Codex model picker with Codex Router. GLM is available through two provider paths that bill separately: the Ollama Cloud provider and the Z.ai GLM Coding Plan provider.

GLMGLMOllama CloudCoding Plan

What you can add

Picker labelModel IDAuthentication
GLM-5.2 (Ollama Cloud)ollama-cloud/glm-5.2Ollama Cloud API key
GLM-5.2 (Coding Plan)zai-coding/glm-5.2Z.ai GLM Coding Plan API key
GLM-5-Turbo (Coding Plan)zai-coding/glm-5-turboZ.ai GLM Coding Plan API key

GLM-5.2 is also resold through the Alibaba Model Studio plan as qwen-plan/glm-5.2 — that entry coexists because it is billed by the Alibaba plan, not by Z.ai or Ollama. This page covers the two direct paths.

Choose your path

  • Ollama Cloud bills through an ollama.com account. You get an account API key, and the router reads context windows from Ollama’s published model metadata. Use this if you already use Ollama or want GLM alongside other Ollama Cloud models such as Kimi K2.7 Code, MiniMax M3 and DeepSeek V4 Pro.
  • Z.ai GLM Coding Plan uses the plan’s dedicated coding endpoint and its subscription API key. Use this if you subscribe to the GLM Coding Plan and want the plan’s quota and the zai-coding provider’s thinking behavior.

Enable Ollama Cloud

./bin/model-router codex provider-key ollama-cloud set
./bin/model-router codex providers enable ollama-cloud

The key prompt is hidden and stores the value in a protected per-user file. On Windows, use ./codex-router.ps1 codex provider-key ollama-cloud set.

Enable the Z.ai GLM Coding Plan

./bin/model-router codex provider-key zai-coding set
./bin/model-router codex providers enable zai-coding

The Z.ai coding key is not interchangeable with general Z.ai platform keys. Only the GLM Coding Plan subscription key works with the coding endpoint, and Z.ai reserves that endpoint for interactive coding tools. A general Z.ai platform key will fail authentication on this route.

Verify the integration

./bin/model-router codex doctor
./bin/model-router codex providers

The provider you enabled must report SHOW and ready. Then fully quit Codex, reopen it, create a new task, and check the picker for GLM-5.2. For a live, quota-consuming check:

./bin/test-model 'zai-coding/glm-5.2' --live --yes

How GLM requests behave

The zai-coding route uses the GLM Coding Plan’s dedicated endpoint, enables thinking, maps Codex’s maximum reasoning tier to Z.ai’s max effort, and drops sampling overrides that conflict with thinking mode. GLM-5.2 exposes two documented effort tiers; the forwarder sends them explicitly, and upstream defaults to max when the parameter is omitted, which matches Z.ai’s recommendation. GLM-5-Turbo does not advertise effort control it does not support.

Common pitfalls

  • Keys and quotas are provider-specific. An Ollama Cloud key bills Ollama; a Z.ai Coding Plan key bills Z.ai; an Alibaba plan key bills Alibaba. None of them authenticate each other.
  • Missing picker entries usually mean missing credentials. Confirm the provider reports ready, then restart Codex. See models missing from the picker.
  • Provider policy risk. Z.ai and ollama.com may restrict or block proxy traffic. Using GLM through Codex Router is at your own risk.
  • Windows users: the key commands go through ./codex-router.ps1 codex provider-key ...; the rest of the flow is identical.

Related: models overview, DeepSeek in Codex, Kimi in Codex, installation.