You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What terminal emulator and version are you using (if applicable)?
Ghostty
What issue are you seeing?
Z.AI GLM-4.7 Integration Issue Summary
Current Status: BLOCKED - Codex Bug
Issue Description
When using Z.AI's GLM-4.7 model with Codex CLI, getting error:
{"error":{"code":"1214","message":"Incorrect role information"}}
Root Cause
Codex is sending messages with the developer role (used in OpenAI's Responses API and newer models), but Z.AI's Chat Completions endpoint only accepts:
system
user
assistant
What We've Tried
✅ Fixed Issues
API Key: Changed env_key from ZAI_API_KEY to Z_AI_API_KEY (with underscore)
Endpoint: Set wire_api = "chat" so Codex calls /chat/completions instead of /responses
MCP Servers: Fixed "Bearer Bearer" bug using env_http_headers workaround
❌ Current Blocker
Codex is not converting developer role to system role when using wire_api = "chat" with custom providers.
Current Configuration
[model_providers.zai]
name = "Z.AI Coding Plan"base_url = "https://api.z.ai/api/coding/paas/v4"env_key = "Z_AI_API_KEY"wire_api = "chat"# Should trigger role conversion, but doesn't
[profiles.glm]
model_provider = "zai"model = "GLM-4.7"sandbox_mode = "danger-full-access"approval_policy = "never"forced_login_method = "api"
Missing Configuration Option
Codex does NOT have a documented configuration option for role mapping like:
role_map (doesn't exist)
supports_developer_role (doesn't exist)
use_system_role (doesn't exist)
Evidence
Z.AI API docs show they support standard OpenAI Chat Completions format with system, user, assistant roles
Configure custom provider in ~/.codex/config.toml:
[model_providers.zai]
name = "Z.AI Coding Plan"base_url = "https://api.z.ai/api/coding/paas/v4"env_key = "Z_AI_API_KEY"wire_api = "chat"# Explicitly set to use Chat Completions format
[profiles.glm]
model_provider = "zai"model = "GLM-4.7"sandbox_mode = "danger-full-access"approval_policy = "never"forced_login_method = "api"
Add Z_AI_API_KEY to shell environment whitelist:
[shell_environment_policy]
inherit = "none"include_only = [
"PATH",
"HOME",
"Z_AI_API_KEY",
# ... other vars
]
Launch Codex with the GLM profile:
codex --profile glm
Send any message (even a simple "hello"):
> hello
Observe the error:
{"error":{"code":"1214","message":"Incorrect role information"}}
Expected Behavior
When wire_api = "chat" is set, Codex should:
Convert internal developer role messages to system role
Send standard Chat Completions format to Z.AI
Successfully receive responses from GLM-4.7
Actual Behavior
Codex sends messages with developer role to Z.AI's Chat Completions endpoint, which only accepts system, user, and assistant roles, resulting in error code 1214.
Successfully receive responses from the GLM-4.7 model without role-related errors
Work seamlessly with custom providers that implement the OpenAI Chat Completions API standard
Why This Should Work
The wire_api = "chat" setting exists specifically to tell Codex: "This provider uses the Chat Completions API format"
OpenAI's Chat Completions API uses system, user, and assistant roles
OpenAI's newer Responses API (and GPT-5+ models) use the developer role
Codex should handle this translation automatically when switching between API formats
Current Actual Behavior
Instead, Codex is:
Sending messages with the developer role directly to Z.AI
Not performing the role conversion despite wire_api = "chat" being set
Causing Z.AI to reject the request with error code 1214: "Incorrect role information"
This appears to be a bug where the role conversion logic works for OpenAI's own endpoints but doesn't work for custom providers, even when they're explicitly configured to use the Chat Completions format.
What version of Codex is running?
codex-cli 0.88.0-alpha.17
What subscription do you have?
Pro
Which model were you using?
No response
What platform is your computer?
arwin 25.3.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
Ghostty
What issue are you seeing?
Z.AI GLM-4.7 Integration Issue Summary
Current Status: BLOCKED - Codex Bug
Issue Description
When using Z.AI's GLM-4.7 model with Codex CLI, getting error:
{"error":{"code":"1214","message":"Incorrect role information"}}Root Cause
Codex is sending messages with the
developerrole (used in OpenAI's Responses API and newer models), but Z.AI's Chat Completions endpoint only accepts:systemuserassistantWhat We've Tried
✅ Fixed Issues
env_keyfromZAI_API_KEYtoZ_AI_API_KEY(with underscore)wire_api = "chat"so Codex calls/chat/completionsinstead of/responsesenv_http_headersworkaround❌ Current Blocker
Codex is not converting
developerrole tosystemrole when usingwire_api = "chat"with custom providers.Current Configuration
Missing Configuration Option
Codex does NOT have a documented configuration option for role mapping like:
role_map(doesn't exist)supports_developer_role(doesn't exist)use_system_role(doesn't exist)Evidence
system,user,assistantrolesdeveloperrole, but Chat Completions API usessystemrolewire_api = "chat"but appears not to for custom providersReferences
Date
2026-01-21
What steps can reproduce the bug?
Set up Z.AI API key:
Configure custom provider in
~/.codex/config.toml:Add Z_AI_API_KEY to shell environment whitelist:
Launch Codex with the GLM profile:
Send any message (even a simple "hello"):
Observe the error:
{"error":{"code":"1214","message":"Incorrect role information"}}Expected Behavior
When
wire_api = "chat"is set, Codex should:developerrole messages tosystemroleActual Behavior
Codex sends messages with
developerrole to Z.AI's Chat Completions endpoint, which only acceptssystem,user, andassistantroles, resulting in error code 1214.Environment
codex --version)What is the expected behavior?
When wire_api = "chat" is set in the model provider configuration, Codex should:
Automatically convert role names from Codex's internal format to the Chat Completions API format:
developer role → system role
Keep user and assistant roles as-is
Send standard OpenAI Chat Completions format to Z.AI's endpoint at https://api.z.ai/api/coding/paas/v4/chat/completions
Successfully receive responses from the GLM-4.7 model without role-related errors
Work seamlessly with custom providers that implement the OpenAI Chat Completions API standard
Why This Should Work
The wire_api = "chat" setting exists specifically to tell Codex: "This provider uses the Chat Completions API format"
OpenAI's Chat Completions API uses system, user, and assistant roles
OpenAI's newer Responses API (and GPT-5+ models) use the developer role
Codex should handle this translation automatically when switching between API formats
Current Actual Behavior
Instead, Codex is:
Sending messages with the developer role directly to Z.AI
Not performing the role conversion despite wire_api = "chat" being set
Causing Z.AI to reject the request with error code 1214: "Incorrect role information"
This appears to be a bug where the role conversion logic works for OpenAI's own endpoints but doesn't work for custom providers, even when they're explicitly configured to use the Chat Completions format.
Additional information
No response