Add support for grok4
Resolved 💬 4 comments Opened Jul 11, 2025 by vitatea2023 Closed Jul 15, 2025
💡 Likely answer: A maintainer (bolinfest, collaborator)
responded on this thread — see the highlighted reply below.
What version of Codex is running?
codex-cli 0.5.0
Which model were you using?
grok4
What platform is your computer?
Linux 6.14.3-x86_64-linode168 x86_64 unknown
What steps can reproduce the bug?
(base) root@localhost:~# cat ~/.codex/config.toml
# Codex CLI 配置文件
[model_providers.xai]
name = "xAI"
base_url = "https://api.x.ai/v1"
env_key = "XAI_API_KEY"
[profiles.xai-grok4]
model_provider = "xai"
model = "grok-4"
(base) root@localhost:~# export XAI_API_KEY="xai-vYi4MiPxxxxxxxxxxxxxxxxxxxxxxxxxxx09Bm2iv"
(base) root@localhost:~# mkdir -p code/codex
(base) root@localhost:~# cd code/codex
(base) root@localhost:~/code/codex# codex --profile xai-grok4
<img width="1027" height="527" alt="Image" src="https://github.com/user-attachments/assets/46e4e9fd-013f-40fa-864b-299bca98aa74" />
What is the expected behavior?
be able to execute command
What do you see instead?
nothing happened if ask to execute command
Additional information
_No response_
4 Comments
I would run it with
RUST_LOG=debugand thentail -F ~/.codex/log/codex-tui.logto see if that tells you anything interesting. I can't say why it does not appear to be responding to the chat completions request.<img width="3373" height="1914" alt="Image" src="https://github.com/user-attachments/assets/71082ff4-18d7-40c8-9379-4d5cdaf4370a" />
when i am using v0.7.0 it works good
<img width="3373" height="1914" alt="Image" src="https://github.com/user-attachments/assets/dfb42a46-3ff0-454c-a045-cd0cebab4951" />
when i am using v0.5.0 it also works good now, i do not know why this
I installed the v0.5.0 version in a brand new environment, but still cannot reproduce my previous error, so I tend to think that this may be an issue with the initial grok4 API interface service.