sub2api icon indicating copy to clipboard operation
sub2api copied to clipboard

fix: Grok Responses returns 426 — pinned CLIClientVersion 0.2.120 is below xAI's new minimum 1.0.13

Open leo8103lee opened this issue 2 months ago • 12 comments

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

  1. Bump CLIClientVersion to a current stable (e.g. 1.0.44). Because this is the single pin, it also fixes the OAuth/Responses path and billingCLIUserAgent.
  2. 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 main pins CLIClientVersion = "0.2.120" (latest release at time of writing: v0.2.11)
  • Upstream: Grok (xAI) via Grok CLI proxy

leo8103lee avatar Sep 30 '26 22:09 leo8103lee

same problem

Alex-Joe-Lee avatar Oct 01 '26 02:10 Alex-Joe-Lee

同样的问题

ccnetcore avatar Oct 01 '26 02:10 ccnetcore

Image try this until next upgrade

xcrong avatar Oct 01 '26 02:10 xcrong

Image try this until next upgrade

这边我测试下

ccnetcore avatar Oct 01 '26 02:10 ccnetcore

昨晚3点过都还能用,4点过就报这个版本问题了

chenxiaopa avatar Oct 01 '26 02:10 chenxiaopa

Image try this until next upgrade

该方案,已解决,没问题了,感谢,后面的兄弟看下

ccnetcore avatar Oct 01 '26 02:10 ccnetcore

这个方案只能访问https://api.x.ai/v1 无法使用https://cli-chat-proxy.grok.com/v1

gxcnlee avatar Oct 01 '26 05:10 gxcnlee

docker部署的要怎么修复

lovezm avatar Oct 01 '26 07:10 lovezm

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
        }

LetMeKnowC avatar Oct 01 '26 09:10 LetMeKnowC

Thanks for the detailed write-up — this is useful context for anyone debugging this.

goransh-walia avatar Oct 01 '26 09:10 goransh-walia

什么时候能更新啊》?

bbhxwl avatar Oct 01 '26 14:10 bbhxwl

什么时候更新版本呀

hopeaiai avatar Oct 01 '26 14:10 hopeaiai