Skip to content

Commit bf6ac97

Browse files
authored
xAI/grok-4-fast (#5006)
* integrate grok 4 fast with zai * test * fix release date; * update model name * update tests
1 parent 2e6e24b commit bf6ac97

File tree

4 files changed

+386
-5
lines changed

4 files changed

+386
-5
lines changed

packages/__tests__/cost/__snapshots__/registrySnapshots.test.ts.snap

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,6 +3099,29 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = `
30993099
"*",
31003100
],
31013101
},
3102+
"grok-4-fast-reasoning:xai": {
3103+
"context": 2000000,
3104+
"crossRegion": false,
3105+
"maxTokens": 30000,
3106+
"modelId": "grok-4-fast",
3107+
"parameters": [
3108+
"logprobs",
3109+
"max_tokens",
3110+
"response_format",
3111+
"seed",
3112+
"structured_outputs",
3113+
"temperature",
3114+
"tool_choice",
3115+
"tools",
3116+
"top_logprobs",
3117+
"top_p",
3118+
],
3119+
"provider": "xai",
3120+
"ptbEnabled": true,
3121+
"regions": [
3122+
"*",
3123+
],
3124+
},
31023125
"grok-4:openrouter": {
31033126
"context": 256000,
31043127
"crossRegion": false,
@@ -3429,6 +3452,7 @@ exports[`Registry Snapshots model coverage snapshot 1`] = `
34293452
"xai",
34303453
"xai",
34313454
"xai",
3455+
"xai",
34323456
],
34333457
"zai/glm-4": [
34343458
"novita",
@@ -4612,6 +4636,12 @@ exports[`Registry Snapshots verify registry state 1`] = `
46124636
"xai",
46134637
],
46144638
},
4639+
{
4640+
"model": "grok-4-fast-reasoning",
4641+
"providers": [
4642+
"xai",
4643+
],
4644+
},
46154645
{
46164646
"model": "grok-code-fast-1",
46174647
"providers": [
@@ -4825,7 +4855,7 @@ exports[`Registry Snapshots verify registry state 1`] = `
48254855
"provider": "vertex",
48264856
},
48274857
{
4828-
"modelCount": 4,
4858+
"modelCount": 5,
48294859
"provider": "xai",
48304860
},
48314861
],
@@ -4863,6 +4893,7 @@ exports[`Registry Snapshots verify registry state 1`] = `
48634893
"grok-3",
48644894
"grok-3-mini",
48654895
"grok-4",
4896+
"grok-4-fast-reasoning",
48664897
"grok-code-fast-1",
48674898
"kimi-k2",
48684899
"kimi-k2-0905",
@@ -4897,9 +4928,9 @@ exports[`Registry Snapshots verify registry state 1`] = `
48974928
"claude-3.5-haiku:openrouter:*",
48984929
],
48994930
"totalArchivedConfigs": 0,
4900-
"totalEndpoints": 136,
4901-
"totalModelProviderConfigs": 136,
4902-
"totalModelsWithPtb": 57,
4931+
"totalEndpoints": 137,
4932+
"totalModelProviderConfigs": 137,
4933+
"totalModelsWithPtb": 58,
49034934
"totalProviders": 12,
49044935
}
49054936
`;

packages/cost/models/authors/xai/endpoints.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,49 @@ export const endpoints = {
9595
"*": {},
9696
},
9797
},
98+
"grok-4-fast-reasoning:xai": {
99+
providerModelId: "grok-4-fast",
100+
provider: "xai",
101+
author: "xai",
102+
pricing: [
103+
{
104+
threshold: 0,
105+
input: 0.0000002, // $0.20 per 1M tokens (up to 128K context)
106+
output: 0.0000005, // $0.50 per 1M tokens (up to 128K context)
107+
web_search: 0.025, // $25.00 per 1K sources
108+
cacheMultipliers: {
109+
cachedInput: 0.25, // $0.05 / $0.20 = 0.25
110+
},
111+
},
112+
{
113+
threshold: 128000, // Above 128K context window
114+
input: 0.0000004, // $0.40 per 1M tokens (over 128K context)
115+
output: 0.000001, // $1.00 per 1M tokens (over 128K context)
116+
web_search: 0.025, // $25.00 per 1K sources
117+
cacheMultipliers: {
118+
cachedInput: 0.125, // $0.05 / $0.40 = 0.125
119+
},
120+
},
121+
],
122+
contextLength: 2_000_000,
123+
maxCompletionTokens: 30_000,
124+
supportedParameters: [
125+
"tools",
126+
"tool_choice",
127+
"structured_outputs",
128+
"response_format",
129+
"max_tokens",
130+
"temperature",
131+
"top_p",
132+
"seed",
133+
"logprobs",
134+
"top_logprobs"
135+
],
136+
ptbEnabled: true,
137+
endpointConfigs: {
138+
"*": {},
139+
},
140+
},
98141
"grok-3:xai": {
99142
providerModelId: "grok-3",
100143
provider: "xai",

packages/cost/models/authors/xai/models.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ export const models = {
2323
modality: { inputs: ["text"], outputs: ["text"] },
2424
tokenizer: "Grok",
2525
},
26+
"grok-4-fast-reasoning": {
27+
name: "xAI: Grok 4 Fast Reasoning",
28+
author: "xai",
29+
description:
30+
"Grok 4 Fast is xAI's latest advancement in cost-efficient reasoning models. Built on xAI’s learnings from Grok 4, Grok 4 Fast delivers frontier-level performance across Enterprise and Consumer domains—with exceptional token efficiency. This model pushes the boundaries for smaller and faster AI, making high-quality reasoning accessible to more users and developers. Grok 4 Fast features state-of-the-art (SOTA) cost-efficiency, cutting-edge web and X search capabilities, a 2M token context window, and a unified architecture that blends reasoning and non-reasoning modes in one model.",
31+
contextLength: 2_000_000,
32+
maxOutputTokens: 30_000,
33+
created: "2025-09-01T00:00:00.000Z",
34+
modality: { inputs: ["text", "image"], outputs: ["text"] },
35+
tokenizer: "Grok",
36+
},
2637
"grok-3": {
2738
name: "xAI: Grok 3",
2839
author: "xai",
@@ -47,4 +58,4 @@ export const models = {
4758
},
4859
} satisfies Record<string, ModelConfig>;
4960

50-
export type GrokModelName = keyof typeof models;
61+
export type GrokModelName = keyof typeof models;

0 commit comments

Comments
 (0)