Merge pull request #8831 from uinstinct/grok-4.1-support

chore: add support for grok 4.1 fast
This commit is contained in:
Dallin Romney 2025-11-25 12:01:09 -08:00 • committed by GitHub
commit 3b7b21b45a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 63 additions and 9 deletions

View file

@ -120,7 +120,7 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => boolean> =
},
xAI: (model) => {
const lowerCaseModel = model.toLowerCase();
return ["grok-3", "grok-4", "grok-code"].some((val) =>
return ["grok-3", "grok-4", "grok-4-1", "grok-code"].some((val) =>
lowerCaseModel.includes(val),
);
},
@ -396,6 +396,7 @@ export function isRecommendedAgentModel(modelName: string): boolean {
[/claude/, /sonnet/, /3\.7|3-7|-4/],
[/claude/, /opus/, /-4/],
[/grok-code/],
[/grok-4-1|grok-4\.1/],
[/claude/, /4-5/],
];
for (const combo of recs) {

View file

@ -95,20 +95,20 @@ If you prefer to use a model from [OpenAI](../model-providers/top-level/openai),
</Tab>
</Tabs>
### Grok-2 from xAI
### Grok-4 from xAI
If you prefer to use a model from [xAI](../model-providers/more/xAI), then we recommend Grok-2.
If you prefer to use a model from [xAI](../model-providers/more/xAI), then we recommend Grok-4.
<Tabs>
<Tab title="Hub">
Add the [xAI Grok-2 block](https://hub.continue.dev/xai/grok-2) from the hub
Add the [xAI Grok-4.1 block](https://hub.continue.dev/xai/grok-4-1-fast-non-reasoning) from the hub
</Tab>
<Tab title="YAML">
```yaml title="config.yaml"
models:
- name: Grok-2
- name: Grok-4.1
provider: xAI
model: grok-2-latest
model: grok-4-1-fast-non-reasoning
apiKey: <YOUR_XAI_API_KEY>
```
</Tab>

View file

@ -10,7 +10,7 @@ export function isModelCapable(
const normalizedName = name.toLowerCase();
const normalizedModel = model ? model.toLowerCase() : "";
const patterns = [/gemini/, /claude/, /gpt/, /o\d/, /kimi/, /qwen/];
const patterns = [/gemini/, /claude/, /gpt/, /o\d/, /kimi/, /qwen/, /grok/];
// If either name OR model matches any of the patterns, consider it capable
if (patterns.some((pattern) => pattern.test(normalizedName))) {

View file

@ -1908,6 +1908,34 @@ export const models: { [key: string]: ModelPackage } = {
providerOptions: ["xAI"],
isOpenSource: false,
},
grok41FastReasoning: {
title: "Grok 4.1 Fast Reasoning",
description:
"xAI's upgraded reasoning model offering strong performance in complex tasks.",
refUrl: "https://docs.x.ai/docs/models/grok-4-1-fast-reasoning",
params: {
title: "Grok 4.1 Fast Reasoning",
model: "grok-4-1-fast-reasoning",
contextLength: 2_000_000,
},
icon: "xAI.png",
providerOptions: ["xAI"],
isOpenSource: false,
},
grok41FastNonReasoning: {
title: "Grok 4.1 Fast Non-Reasoning",
description:
"xAI's upgraded non-reasoning model optimized for speed and efficiency.",
refUrl: "https://docs.x.ai/docs/models/grok-4-1-fast-non-reasoning",
params: {
title: "Grok 4.1 Fast Non-Reasoning",
model: "grok-4-1-fast-non-reasoning",
contextLength: 2_000_000,
},
icon: "xAI.png",
providerOptions: ["xAI"],
isOpenSource: false,
},
grok4: {
title: "Grok 4",
description:

View file

@ -624,6 +624,8 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
models.grokCodeFast1,
models.grok4FastReasoning,
models.grok4FastNonReasoning,
models.grok41FastReasoning,
models.grok41FastNonReasoning,
models.grok4,
models.grok3,
models.grok3Mini,

View file

@ -173,10 +173,19 @@ export const CometAPI: ModelProvider = {
},
// Grok Series
{
model: "grok-4-1-fast-reasoning",
displayName: "Grok 4.1 Fast Reasoning",
contextLength: 256000,
maxCompletionTokens: 4096,
description:
"Latest Grok model with faster and improved reasoning and conversational abilities.",
recommendedFor: ["chat"],
},
{
model: "grok-4-0709",
displayName: "Grok 4 (07-09)",
contextLength: 128000,
contextLength: 256000,
maxCompletionTokens: 4096,
description:
"Latest Grok model with improved reasoning and conversational abilities.",

View file

@ -52,7 +52,21 @@ export const xAI: ModelProvider = {
displayName: "Grok 4 Fast",
contextLength: 256000,
recommendedFor: ["chat"],
regex: /grok-4/,
regex: /^grok-4$/,
},
{
model: "grok-4-1-fast-reasoning",
displayName: "Grok 4.1 Fast Reasoning",
contextLength: 256000,
recommendedFor: ["chat"],
regex: /grok-4-1-fast-reasoning/,
},
{
model: "grok-4-1-fast-non-reasoning",
displayName: "Grok 4.1 Fast Non Reasoning",
contextLength: 256000,
recommendedFor: ["chat"],
regex: /grok-4-1-fast-non-reasoning/,
},
{
model: "grok-code-fast-1",