fix: Grok Responses returns 426 — pinned CLIClientVersion 0.2.120 is below xAI's new minimum 1.0.13
Summary
Grok account connection tests / /v1/responses proxying fail with HTTP 426 because the pinned Grok CLI version is now below xAI's minimum:
Grok Responses API returned 426: {"error":"Your Grok CLI version (0.2.120) is outdated. Please update to version 1.0.13 or later via `grok update` or the installation documentation."}
This is the same class of problem as #3952 (there the version was none and the floor was 0.1.202); this time the header is sent, but the pinned value is too old.
Root cause
backend/internal/pkg/xai/billing.go:
// Keep in sync with https://x.ai/cli/stable.
CLIClientVersion = "0.2.120"
xAI's CLI versioning moved from 0.2.x to 1.0.x, so 0.2.120 now compares lower than the new minimum 1.0.13. At the time of writing https://x.ai/cli/stable returns 1.0.44.
Suggested fix
- Bump
CLIClientVersionto a current stable (e.g.1.0.44). Because this is the single pin, it also fixes the OAuth/Responses path andbillingCLIUserAgent. - Because xAI has now raised the floor twice in a month, consider resolving the version at runtime (e.g. from
https://x.ai/cli/stable, cached, falling back to the pin) instead of requiring a release each time.
Possible workaround (not fully verified)
cli_identity.go supports XAI_GROK_CLI_VERSION (must be >= CLIClientVersion), so setting XAI_GROK_CLI_VERSION=1.0.44 should fix the upstream request path.
One thing to double check: billing.go sets the header with the constant directly (req.Header.Set(CLIClientVersionHeader, CLIClientVersion)), not via ResolveCLIVersion(), so billing probes may keep sending 0.2.120 even with the env override. Using ResolveCLIVersion() there would make the override consistent.
Environment
- Sub2API: current
mainpinsCLIClientVersion = "0.2.120"(latest release at time of writing: v0.2.11) - Upstream: Grok (xAI) via Grok CLI proxy
same problem
同样的问题
try this until next upgrade
try this until next upgrade
这边我测试下
昨晚3点过都还能用,4点过就报这个版本问题了
try this until next upgrade
该方案,已解决,没问题了,感谢,后面的兄弟看下
这个方案只能访问https://api.x.ai/v1 无法使用https://cli-chat-proxy.grok.com/v1
docker部署的要怎么修复
for macos
vi ~/Library/LaunchAgents/com.sub2api.server.plist
......
<!-- 环境变量 -->
<key>EnvironmentVariables</key>
<dict>
<key>XAI_GROK_CLI_VERSION</key>
<string>1.0.44</string>
</dict>
......
% launchctl bootout gui/$(id -u)/com.sub2api.server
% launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.sub2api.server.plist
% launchctl print gui/$(id -u)/com.sub2api.server | grep -A5 "environment ="
inherited environment = {
SSH_AUTH_SOCK => /var/run/com.apple.launchd.eMT8wp7npH/Listeners
}
default environment = {
PATH => /usr/bin:/bin:/usr/sbin:/sbin
}
environment = {
OSLogRateLimit => 64
XAI_GROK_CLI_VERSION => 1.0.44
XPC_SERVICE_NAME => com.sub2api.server
}
Thanks for the detailed write-up — this is useful context for anyone debugging this.
什么时候能更新啊》?
什么时候更新版本呀
try this until next upgrade
try this until next upgrade