Summary
Routing Codex to Z.AI's GLM-5.2 1M-context variant with the model ID
glm-5.2[1m] fails on every request with an upstream 400 error
(Z.AI code 1211, "Unknown Model"). The bare glm-5.2 code is accepted by
the provider; only the bracketed [1m] variant is rejected.
glm-5.2[1m] is Z.AI's documented, official model ID for the 1M-context
variant, so this looks like a model-string passthrough issue in opencodex
rather than an invalid model on my side.
Environment
- opencodex version: [e.g. output of
ocx --version]
- Codex CLI version: [e.g.
codex --version]
- OS: [macOS / Linux / Windows + arch]
- Provider / adapter: Z.AI GLM Coding Plan via
openai-chat adapter
- baseUrl: [the Z.AI endpoint configured in config.json]
- Auth mode: key
Steps to reproduce
- Configure a Z.AI (GLM) provider in
~/.opencodex/config.json using the
openai-chat adapter.
- Start the proxy:
ocx start
- Run Codex against the 1M variant:
codex -m "<provider>/glm-5.2[1m]" "hello"
Expected
Request routes to GLM-5.2 with the 1M context window. Z.AI documents
glm-5.2[1m] as the model name that enables the 1M-context variant.
Actual
The request fails with:
{"error":{"message":"Provider error 400: {"error":{"code":"1211","message":"Unknown Model, please check the model code.\n"}}","type":"upstream_error","code":null}}
For comparison, glm-5.2 (without the [1m] suffix) routes successfully
through the same provider config.
Likely cause
1211 / "Unknown Model, please check the model code." is Z.AI's response
when the model field does not match a known model code. It appears opencodex
forwards the model string glm-5.2[1m] verbatim as the model value to the
upstream OpenAI-compatible chat-completions endpoint, which does not accept
the bracketed [1m] suffix — Z.AI only recognizes the bare code (glm-5.2) on
that path.
The [1m] suffix is a Z.AI convention documented specifically for the
Anthropic-compatible (Claude Code) endpoint, where it is set via
ANTHROPIC_DEFAULT_SONNET_MODEL=glm-5.2[1m]. It does not seem to be valid as a
chat-completions model value, so passing it straight through the openai-chat
adapter breaks.
Questions / suggestions
- Should opencodex strip or translate the
[1m] (and similar bracketed)
suffix before forwarding to the openai-chat adapter, while still enabling
the 1M context another way (e.g. an explicit context/param)?
- Or should the GLM-5.2 1M variant be documented as only reachable through the
anthropic adapter pointed at Z.AI's Anthropic-compatible endpoint?
- What is the currently recommended opencodex config to use the GLM-5.2 1M
variant?
Happy to provide a redacted config.json or proxy request log if useful.
Summary
Routing Codex to Z.AI's GLM-5.2 1M-context variant with the model ID
glm-5.2[1m]fails on every request with an upstream 400 error(Z.AI code
1211, "Unknown Model"). The bareglm-5.2code is accepted bythe provider; only the bracketed
[1m]variant is rejected.glm-5.2[1m]is Z.AI's documented, official model ID for the 1M-contextvariant, so this looks like a model-string passthrough issue in opencodex
rather than an invalid model on my side.
Environment
ocx --version]codex --version]openai-chatadapterSteps to reproduce
~/.opencodex/config.jsonusing theopenai-chatadapter.ocx startcodex -m "<provider>/glm-5.2[1m]" "hello"Expected
Request routes to GLM-5.2 with the 1M context window. Z.AI documents
glm-5.2[1m]as the model name that enables the 1M-context variant.Actual
The request fails with:
{"error":{"message":"Provider error 400: {"error":{"code":"1211","message":"Unknown Model, please check the model code.\n"}}","type":"upstream_error","code":null}}
For comparison,
glm-5.2(without the[1m]suffix) routes successfullythrough the same provider config.
Likely cause
1211 / "Unknown Model, please check the model code."is Z.AI's responsewhen the
modelfield does not match a known model code. It appears opencodexforwards the model string
glm-5.2[1m]verbatim as themodelvalue to theupstream OpenAI-compatible chat-completions endpoint, which does not accept
the bracketed
[1m]suffix — Z.AI only recognizes the bare code (glm-5.2) onthat path.
The
[1m]suffix is a Z.AI convention documented specifically for theAnthropic-compatible (Claude Code) endpoint, where it is set via
ANTHROPIC_DEFAULT_SONNET_MODEL=glm-5.2[1m]. It does not seem to be valid as achat-completions
modelvalue, so passing it straight through theopenai-chatadapter breaks.
Questions / suggestions
[1m](and similar bracketed)suffix before forwarding to the
openai-chatadapter, while still enablingthe 1M context another way (e.g. an explicit context/param)?
anthropicadapter pointed at Z.AI's Anthropic-compatible endpoint?variant?
Happy to provide a redacted config.json or proxy request log if useful.