@kenkaiiii/gg-ai 5.35.1 → 5.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3576,6 +3576,8 @@ function sanitizeMessagesForWire(messages) {
|
|
|
3576
3576
|
// src/stream.ts
|
|
3577
3577
|
var GLM_CODING_BASE_URL = "https://api.z.ai/api/coding/paas/v4";
|
|
3578
3578
|
var KIMI_CODE_USER_AGENT = `kimi-code-cli/${process.env.KIMI_CODE_VERSION ?? "1.0.11"}`;
|
|
3579
|
+
var GROK_CLI_PROXY_HOST = "cli-chat-proxy.grok.com";
|
|
3580
|
+
var GROK_CLI_VERSION = process.env.GROK_CLI_VERSION ?? "0.2.101";
|
|
3579
3581
|
providerRegistry.register("anthropic", {
|
|
3580
3582
|
stream: (options) => streamAnthropic(options)
|
|
3581
3583
|
});
|
|
@@ -3636,13 +3638,25 @@ providerRegistry.register("xai", {
|
|
|
3636
3638
|
// xAI's public API (console.x.ai key) is OpenAI-compatible — ride the Chat
|
|
3637
3639
|
// Completions transport like Moonshot/DeepSeek. Grok reasoning models take
|
|
3638
3640
|
// top-level `reasoning_effort` (low/medium/high), which the shared thinking
|
|
3639
|
-
// path already sends.
|
|
3640
|
-
//
|
|
3641
|
-
//
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3641
|
+
// path already sends.
|
|
3642
|
+
//
|
|
3643
|
+
// Subscription OAuth (SuperGrok / X Premium) routes to the Grok CLI chat proxy
|
|
3644
|
+
// instead, which speaks the same Chat Completions wire but gates on Grok-CLI
|
|
3645
|
+
// client identity. Inject those headers centrally here — exactly as the Kimi
|
|
3646
|
+
// endpoint above — so EVERY stream (agent loop, compaction, title-gen,
|
|
3647
|
+
// sub-agents) is accepted rather than depending on each call site to thread
|
|
3648
|
+
// headers. Caller-provided headers still win on collision.
|
|
3649
|
+
stream: (options) => {
|
|
3650
|
+
const baseUrl = options.baseUrl ?? "https://api.x.ai/v1";
|
|
3651
|
+
const defaultHeaders = baseUrl.includes(GROK_CLI_PROXY_HOST) ? {
|
|
3652
|
+
"X-XAI-Token-Auth": "xai-grok-cli",
|
|
3653
|
+
"x-grok-client-version": GROK_CLI_VERSION,
|
|
3654
|
+
"x-grok-client-identifier": "ggcoder",
|
|
3655
|
+
"x-grok-model-override": options.model,
|
|
3656
|
+
...options.defaultHeaders
|
|
3657
|
+
} : options.defaultHeaders;
|
|
3658
|
+
return streamOpenAI({ ...options, baseUrl, defaultHeaders });
|
|
3659
|
+
}
|
|
3646
3660
|
});
|
|
3647
3661
|
providerRegistry.register("minimax", {
|
|
3648
3662
|
stream: (options) => streamAnthropic({
|