diff --git a/core/llm/llms/xAI.ts b/core/llm/llms/xAI.ts index a6b29f01a..13a69c5fc 100644 --- a/core/llm/llms/xAI.ts +++ b/core/llm/llms/xAI.ts @@ -7,14 +7,6 @@ class xAI extends OpenAI { static defaultOptions: Partial = { apiBase: "https://api.x.ai/v1/", }; - - private static MODEL_IDS: { [name: string]: string } = { - "grok-beta": "grok-beta", // Future names might not line up - }; - - protected _convertModelName(model: string) { - return xAI.MODEL_IDS[model] || this.model; - } } export default xAI; diff --git a/core/llm/toolSupport.test.ts b/core/llm/toolSupport.test.ts index 71f70485f..5f368a9be 100644 --- a/core/llm/toolSupport.test.ts +++ b/core/llm/toolSupport.test.ts @@ -280,6 +280,23 @@ describe("PROVIDER_TOOL_SUPPORT", () => { }); }); + describe("xAI", () => { + const supportsFn = PROVIDER_TOOL_SUPPORT["xAI"]; + + it("should return true for Grok-3 models", () => { + expect(supportsFn("grok-3")).toBe(true); + expect(supportsFn("grok-3-mini")).toBe(true); + expect(supportsFn("grok-3-fast")).toBe(true); + }); + + it("should return true for Grok-4 models", () => { + expect(supportsFn("grok-4")).toBe(true); + expect(supportsFn("grok-4-fast-non-reasoning")).toBe(true); + expect(supportsFn("grok-4-fast-reasoning")).toBe(true); + expect(supportsFn("Grok-4-Fast")).toBe(true); + }); + }); + describe("novita", () => { const supportsFn = PROVIDER_TOOL_SUPPORT["novita"]; diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index 6d1b609e6..7cdbd02cd 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -110,6 +110,10 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = } return ["claude", "gemini"].some((val) => lowerCaseModel.includes(val)); }, + xAI: (model) => { + const lowerCaseModel = model.toLowerCase(); + return ["grok-3", "grok-4"].some((val) => lowerCaseModel.includes(val)); + }, bedrock: (model) => { if ( [ diff --git a/docs/customization/models.mdx b/docs/customization/models.mdx index 779cf0f07..1060b3867 100644 --- a/docs/customization/models.mdx +++ b/docs/customization/models.mdx @@ -65,10 +65,10 @@ Read more about [model roles](/customize/model-roles), [model capabilities](/cus 3. Add `GEMINI_API_KEY` as a [User Secret](https://docs.continue.dev/hub/secrets/secret-types#user-secrets) on Continue Hub [here](https://hub.continue.dev/settings/secrets) 4. Click `Reload config` in the agent selector in the Continue IDE extension -[Grok 4](https://hub.continue.dev/xai/grok-4) from xAI +[Grok Code Fast 1](https://hub.continue.dev/xai/grok-code-fast-1) from xAI 1. Get your API key from [xAI](https://console.x.ai/) -2. Add [Grok 4](https://hub.continue.dev/xai/grok-4) to an agent on Continue Hub +2. Add [Grok Code Fast 1](https://hub.continue.dev/xai/grok-code-fast-1) to an agent on Continue Hub 3. Add `XAI_API_KEY` as a [User Secret](https://docs.continue.dev/hub/secrets/secret-types#user-secrets) on Continue Hub [here](https://hub.continue.dev/settings/secrets) 4. Click `Reload config` in the agent selector in the Continue IDE extension diff --git a/docs/customize/deep-dives/model-capabilities.mdx b/docs/customize/deep-dives/model-capabilities.mdx index 661ce9c5e..eca29cf04 100644 --- a/docs/customize/deep-dives/model-capabilities.mdx +++ b/docs/customize/deep-dives/model-capabilities.mdx @@ -210,9 +210,14 @@ This matrix shows which models support tool use and image input capabilities. Co ### xAI -| Model | Tool Use | Image Input | Context Window | -| :----- | -------- | ----------- | -------------- | -| Grok 4 | Yes | Yes | 128k | +| Model | Tool Use | Image Input | Context Window | +| :------------------------ | -------- | ----------- | -------------- | +| Grok Code Fast 1 | Yes | Yes | 256k | +| Grok 4 Fast Reasoning | Yes | Yes | 2M | +| Grok 4 Fast Non-Reasoning | Yes | Yes | 2M | +| Grok 4 | Yes | Yes | 256k | +| Grok 3 | Yes | Yes | 131k | +| Grok 3 Mini | Yes | Yes | 131k | ### Moonshot AI diff --git a/docs/customize/model-providers/more/xAI.mdx b/docs/customize/model-providers/more/xAI.mdx index 803befe49..c90b2196e 100644 --- a/docs/customize/model-providers/more/xAI.mdx +++ b/docs/customize/model-providers/more/xAI.mdx @@ -3,13 +3,9 @@ title: xAI slug: ../xai --- - - **Discover xAI models [here](https://hub.continue.dev/xai)** - +**Discover xAI models [here](https://hub.continue.dev/xai)** - - Get an API key from the [xAI Console](https://console.x.ai/) - +Get an API key from the [xAI Console](https://console.x.ai/) ## Configuration @@ -29,7 +25,7 @@ slug: ../xai "models": [ { "title": "", - "provider": "anthropic", + "provider": "xai", "model": "", "apiKey": "" } @@ -40,5 +36,6 @@ slug: ../xai - **Check out a more advanced configuration [here](https://hub.continue.dev/xai/grok-4?view=config)** - \ No newline at end of file + **Check out a more advanced configuration + [here](https://hub.continue.dev/xai/grok-code-fast-1?view=config)** + diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index 870b3878c..a45b84004 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -1585,14 +1585,83 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["scaleway", "nebius", "ovhcloud", "ncompass"], isOpenSource: true, }, - grokBeta: { - title: "Grok Beta", - description: "Generative artificial intelligence chatbot developed by xAI.", - refUrl: "", + grokCodeFast1: { + title: "Grok Code Fast 1", + description: + "A speedy and economical reasoning model that excels at agentic coding", + refUrl: "https://docs.x.ai/docs/models/grok-code-fast-1", params: { - title: "Grok Beta", - model: "grok-beta", - contextLength: 128_000, + title: "Grok Code Fast 1", + model: "grok-code-fast-1", + contextLength: 256000, + }, + icon: "xAI.png", + providerOptions: ["xAI", "askSage"], + isOpenSource: false, + }, + grok4FastReasoning: { + title: "Grok 4 Fast Reasoning", + description: "xAI's latest advancement in cost-efficient reasoning models", + refUrl: "https://docs.x.ai/docs/models/grok-4-fast-reasoning", + params: { + title: "Grok 4 Fast Reasoning", + model: "grok-4-fast-reasoning", + contextLength: 2_000_000, + }, + icon: "xAI.png", + providerOptions: ["xAI", "askSage"], + isOpenSource: false, + }, + grok4FastNonReasoning: { + title: "Grok 4 Fast Non-Reasoning", + description: "xAI's latest advancement in cost-efficient models", + refUrl: "https://docs.x.ai/docs/models/grok-4-fast-non-reasoning", + params: { + title: "Grok 4 Fast Non-Reasoning", + model: "grok-4-fast-non-reasoning", + contextLength: 2_000_000, + }, + icon: "xAI.png", + providerOptions: ["xAI", "askSage"], + isOpenSource: false, + }, + grok4: { + title: "Grok 4", + description: + "xAI's latest and greatest flagship model, offering strong performance in natural language, math and reasoning.", + refUrl: "https://docs.x.ai/docs/models/grok-4", + params: { + title: "Grok 4", + model: "grok-4", + contextLength: 256_000, + }, + icon: "xAI.png", + providerOptions: ["xAI", "askSage"], + isOpenSource: false, + }, + grok3: { + title: "Grok 3", + description: + "Excels at enterprise use cases like data extraction, coding, and text summarization", + refUrl: "https://docs.x.ai/docs/models/grok-3", + params: { + title: "Grok 3", + model: "grok-3", + contextLength: 131_072, + }, + icon: "xAI.png", + providerOptions: ["xAI", "askSage"], + isOpenSource: false, + }, + grok3Mini: { + title: "Grok 3 Mini", + description: + "A lightweight model that thinks before responding. Fast, smart, and great for logic-based tasks that do not require deep domain knowledge.", + refUrl: "https://docs.x.ai/docs/models/grok-3-mini", + params: { + title: "Grok 3 Mini", + model: "grok-3-mini", + contextLength: 131_072, }, icon: "xAI.png", providerOptions: ["xAI", "askSage"], diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 95e4d2f05..1e9d5a292 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -622,7 +622,14 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n required: true, }, ], - packages: [models.grokBeta], + packages: [ + models.grokCodeFast1, + models.grok4FastReasoning, + models.grok4FastNonReasoning, + models.grok4, + models.grok3, + models.grok3Mini, + ], apiKeyUrl: "https://console.x.ai/", }, lemonade: { diff --git a/packages/llm-info/package.json b/packages/llm-info/package.json index 68cce0871..8f3d02962 100644 --- a/packages/llm-info/package.json +++ b/packages/llm-info/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/llm-info", - "version": "1.0.9", + "version": "1.0.10", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/llm-info/src/providers/xAI.ts b/packages/llm-info/src/providers/xAI.ts index 96a51c9be..17ec83fa7 100644 --- a/packages/llm-info/src/providers/xAI.ts +++ b/packages/llm-info/src/providers/xAI.ts @@ -7,6 +7,60 @@ export const xAI: ModelProvider = { displayName: "Grok Beta", contextLength: 128000, recommendedFor: ["chat"], + regex: /grok-beta/, + }, + { + model: "grok-2", + displayName: "Grok 2", + contextLength: 131072, + recommendedFor: ["chat"], + regex: /grok-2/, + }, + { + model: "grok-3-mini", + displayName: "Grok 3 Mini", + contextLength: 131072, + maxCompletionTokens: 8000, + recommendedFor: ["chat"], + regex: /grok-3-mini/, + }, + { + model: "grok-3", + displayName: "Grok 3", + contextLength: 131072, + recommendedFor: ["chat"], + regex: /grok-3/, + }, + { + model: "grok-4-fast-reasoning", + displayName: "Grok 4 Fast Reasoning", + contextLength: 2000000, + maxCompletionTokens: 30000, + recommendedFor: ["chat"], + regex: /grok-4-fast-reasoning/, + }, + { + model: "grok-4-fast-non-reasoning", + displayName: "Grok 4 Fast Non-Reasoning", + contextLength: 2000000, + maxCompletionTokens: 30000, + recommendedFor: ["chat"], + regex: /grok-4-fast-non-reasoning/, + }, + { + model: "grok-4", + displayName: "Grok 4 Fast", + contextLength: 256000, + recommendedFor: ["chat"], + regex: /grok-4/, + }, + { + model: "grok-code-fast-1", + displayName: "Grok Code Fast 1", + contextLength: 256000, + maxCompletionTokens: 10000, + recommendedFor: ["chat"], + regex: /grok-code-fast-1/, }, ], id: "xAI",