fix(grok-cli): send Grok CLI 1.0.44 so proxy stops returning HTTP 426
This commit is contained in:
1 parent
b3cf3fdef0
commit
6b9dc54dd2
8 files changed
+19
-14
No files matched your search
@@ -1,8 +1,11 @@
|
||||
export const GROK_CLI_VERSION = "0.2.99";
|
||||
// cli-chat-proxy rejects older identities with HTTP 426. Keep this on a
|
||||
// current @xai-official/grok release (1.0.44 as of 2026-10-01; minimum 1.0.13).
|
||||
export const GROK_CLI_VERSION = "1.0.44";
|
||||
export const GROK_CLI_MODEL = "grok-build";
|
||||
export const GROK_CLI_BASE_URL = "https://cli-chat-proxy.grok.com/v1";
|
||||
export const GROK_CLI_CLIENT_IDENTIFIER = "grok-shell";
|
||||
export const GROK_CLI_USER_AGENT = `grok-shell/${GROK_CLI_VERSION} (linux; x86_64)`;
|
||||
export const GROK_CLI_PAGER_USER_AGENT = `grok-pager/${GROK_CLI_VERSION} grok-shell/${GROK_CLI_VERSION} (linux; x86_64)`;
|
||||
|
||||
export function supportsGrokCliReasoningEffort(model) {
|
||||
// ponytail: unknown models omit effort until live metadata reaches dispatch.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Grok CLI / Grok Build (cli-chat-proxy.grok.com)
|
||||
*
|
||||
* Source of truth: wire capture of official @xai-official/grok 0.2.99
|
||||
* Source of truth: wire capture of official @xai-official/grok 1.0.44
|
||||
* talking to https://cli-chat-proxy.grok.com (OpenAI Responses API).
|
||||
*
|
||||
* Distinct from:
|
||||
|
||||
@@ -5,6 +5,7 @@ import { isOpenAICompatibleProvider, isAnthropicCompatibleProvider } from "@/sha
|
||||
import { getDefaultModel } from "open-sse/config/providerModels.js";
|
||||
import { resolveOllamaLocalHost, PROVIDERS } from "open-sse/config/providers.js";
|
||||
import { CODEX_CLI_VERSION } from "open-sse/config/appConstants.js";
|
||||
import { GROK_CLI_PAGER_USER_AGENT, GROK_CLI_VERSION } from "open-sse/config/grokCli.js";
|
||||
import {
|
||||
refreshProviderCredentials,
|
||||
shouldRefreshCredentials,
|
||||
@@ -123,10 +124,10 @@ const OAUTH_TEST_CONFIG = {
|
||||
extraHeaders: {
|
||||
Accept: "application/json",
|
||||
...(PROVIDERS["grok-cli"]?.headers || {
|
||||
"User-Agent": "grok-pager/0.2.93 grok-shell/0.2.93 (linux; x86_64)",
|
||||
"User-Agent": GROK_CLI_PAGER_USER_AGENT,
|
||||
"x-xai-token-auth": "xai-grok-cli",
|
||||
"x-grok-client-identifier": "grok-pager",
|
||||
"x-grok-client-version": "0.2.93",
|
||||
"x-grok-client-version": GROK_CLI_VERSION,
|
||||
}),
|
||||
},
|
||||
refreshable: true,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { GROK_CLI_PAGER_USER_AGENT, GROK_CLI_VERSION } from "open-sse/config/grokCli.js";
|
||||
import { GROK_CLI_CONFIG } from "../constants/oauth.js";
|
||||
import { decodeXaiIdTokenEmail, extractEmailFromAccessToken } from "../providerHelpers.js";
|
||||
|
||||
@@ -18,7 +19,7 @@ const grokCli = {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
Accept: "application/json",
|
||||
"User-Agent": "grok-pager/0.2.93 grok-shell/0.2.93 (linux; x86_64)",
|
||||
"User-Agent": GROK_CLI_PAGER_USER_AGENT,
|
||||
},
|
||||
body,
|
||||
});
|
||||
@@ -36,7 +37,7 @@ const grokCli = {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
Accept: "application/json",
|
||||
"User-Agent": "grok-pager/0.2.93 grok-shell/0.2.93 (linux; x86_64)",
|
||||
"User-Agent": GROK_CLI_PAGER_USER_AGENT,
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
||||
@@ -69,9 +70,9 @@ const grokCli = {
|
||||
headers: {
|
||||
Authorization: `Bearer ${tokens.access_token}`,
|
||||
Accept: "application/json",
|
||||
"User-Agent": "grok-pager/0.2.93 grok-shell/0.2.93 (linux; x86_64)",
|
||||
"User-Agent": GROK_CLI_PAGER_USER_AGENT,
|
||||
"x-xai-token-auth": "xai-grok-cli",
|
||||
"x-grok-client-version": "0.2.93",
|
||||
"x-grok-client-version": GROK_CLI_VERSION,
|
||||
},
|
||||
});
|
||||
if (res.ok) return { user: await res.json() };
|
||||
|
||||
@@ -417,13 +417,13 @@
|
||||
"modelsUrl": "https://cli-chat-proxy.grok.com/v1/models",
|
||||
"userUrl": "https://cli-chat-proxy.grok.com/v1/user",
|
||||
"billingUrl": "https://cli-chat-proxy.grok.com/v1/billing",
|
||||
"clientVersion": "0.2.99",
|
||||
"clientVersion": "1.0.44",
|
||||
"clientIdentifier": "grok-shell",
|
||||
"tokenAuth": "xai-grok-cli",
|
||||
"headers": {
|
||||
"User-Agent": "grok-shell/0.2.99 (linux; x86_64)",
|
||||
"User-Agent": "grok-shell/1.0.44 (linux; x86_64)",
|
||||
"x-grok-client-identifier": "grok-shell",
|
||||
"x-grok-client-version": "0.2.99"
|
||||
"x-grok-client-version": "1.0.44"
|
||||
},
|
||||
"usage": {
|
||||
"url": "https://cli-chat-proxy.grok.com/v1/billing?format=credits",
|
||||
|
||||
@@ -98,7 +98,7 @@ describe("GrokCliExecutor", () => {
|
||||
expect(headers.Accept).toBe("text/event-stream");
|
||||
expect(headers["x-xai-token-auth"]).toBeUndefined();
|
||||
expect(headers["x-grok-client-identifier"]).toBe("grok-shell");
|
||||
expect(headers["x-grok-client-version"]).toBe("0.2.99");
|
||||
expect(headers["x-grok-client-version"]).toBe("1.0.44");
|
||||
expect(headers["x-grok-session-id"]).toBe("sess-abc");
|
||||
expect(headers["x-grok-conv-id"]).toBe("sess-abc");
|
||||
expect(headers["x-grok-req-id"]).toBe("req-xyz");
|
||||
|
||||
@@ -75,6 +75,6 @@ describe("Grok CLI live models", () => {
|
||||
expect(fetchFn).toHaveBeenCalledTimes(2);
|
||||
expect(fetchFn.mock.calls[0][2]).toBe(proxyOptions);
|
||||
expect(fetchFn.mock.calls[1][1].headers.Authorization).toBe("Bearer new-token");
|
||||
expect(fetchFn.mock.calls[1][1].headers["x-grok-client-version"]).toBe("0.2.99");
|
||||
expect(fetchFn.mock.calls[1][1].headers["x-grok-client-version"]).toBe("1.0.44");
|
||||
});
|
||||
});
|
||||
@@ -272,7 +272,7 @@ describe("getUsageForProvider(grok-cli)", () => {
|
||||
expect(billingCall[0]).toContain("/v1/billing");
|
||||
expect(billingCall[1].headers.Authorization).toBe("Bearer test-token");
|
||||
expect(billingCall[1].headers["x-xai-token-auth"]).toBe("xai-grok-cli");
|
||||
expect(billingCall[1].headers["x-grok-client-version"]).toBe("0.2.99");
|
||||
expect(billingCall[1].headers["x-grok-client-version"]).toBe("1.0.44");
|
||||
expect(billingCall[1].headers["x-grok-client-identifier"]).toBe("grok-shell");
|
||||
expect(billingCall[1].headers["x-userid"]).toBe(
|
||||
"d84768dd-224d-4052-ba49-0d336fa9160c",
|
||||
|
||||
Reference in new issue
Block a user