Skip to content

Commit 4f73e5f

Browse files
authored
Integrate grok-4-fast-non-reasoning for xai provider (#5028)
* integrate grok-4-fast-non-reasoning for xai provider * update description
1 parent d61b5ce commit 4f73e5f

File tree

4 files changed

+392
-9
lines changed

4 files changed

+392
-9
lines changed

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

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,14 +3128,38 @@ exports[`Registry Snapshots endpoint configurations snapshot 1`] = `
31283128
"*",
31293129
],
31303130
},
3131+
"grok-4-fast-non-reasoning:xai": {
3132+
"context": 2000000,
3133+
"crossRegion": false,
3134+
"maxTokens": 2000000,
3135+
"modelId": "grok-4-fast-non-reasoning",
3136+
"parameters": [
3137+
"logprobs",
3138+
"max_tokens",
3139+
"response_format",
3140+
"seed",
3141+
"structured_outputs",
3142+
"temperature",
3143+
"tool_choice",
3144+
"tools",
3145+
"top_logprobs",
3146+
"top_p",
3147+
],
3148+
"provider": "xai",
3149+
"ptbEnabled": true,
3150+
"regions": [
3151+
"*",
3152+
],
3153+
},
31313154
"grok-4-fast-reasoning:xai": {
31323155
"context": 2000000,
31333156
"crossRegion": false,
3134-
"maxTokens": 30000,
3157+
"maxTokens": 2000000,
31353158
"modelId": "grok-4-fast",
31363159
"parameters": [
31373160
"logprobs",
31383161
"max_tokens",
3162+
"reasoning",
31393163
"response_format",
31403164
"seed",
31413165
"structured_outputs",
@@ -3483,6 +3507,7 @@ exports[`Registry Snapshots model coverage snapshot 1`] = `
34833507
"xai",
34843508
"xai",
34853509
"xai",
3510+
"xai",
34863511
],
34873512
"zai/glm-4": [
34883513
"novita",
@@ -4673,6 +4698,12 @@ exports[`Registry Snapshots verify registry state 1`] = `
46734698
"xai",
46744699
],
46754700
},
4701+
{
4702+
"model": "grok-4-fast-non-reasoning",
4703+
"providers": [
4704+
"xai",
4705+
],
4706+
},
46764707
{
46774708
"model": "grok-4-fast-reasoning",
46784709
"providers": [
@@ -4897,7 +4928,7 @@ exports[`Registry Snapshots verify registry state 1`] = `
48974928
"provider": "vertex",
48984929
},
48994930
{
4900-
"modelCount": 5,
4931+
"modelCount": 6,
49014932
"provider": "xai",
49024933
},
49034934
],
@@ -4935,6 +4966,7 @@ exports[`Registry Snapshots verify registry state 1`] = `
49354966
"grok-3",
49364967
"grok-3-mini",
49374968
"grok-4",
4969+
"grok-4-fast-non-reasoning",
49384970
"grok-4-fast-reasoning",
49394971
"grok-code-fast-1",
49404972
"kimi-k2",
@@ -4970,9 +5002,9 @@ exports[`Registry Snapshots verify registry state 1`] = `
49705002
"claude-3.5-haiku:openrouter:*",
49715003
],
49725004
"totalArchivedConfigs": 0,
4973-
"totalEndpoints": 138,
4974-
"totalModelProviderConfigs": 138,
4975-
"totalModelsWithPtb": 58,
5005+
"totalEndpoints": 139,
5006+
"totalModelProviderConfigs": 139,
5007+
"totalModelsWithPtb": 59,
49765008
"totalProviders": 13,
49775009
}
49785010
`;

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

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const endpoints = {
120120
},
121121
],
122122
contextLength: 2_000_000,
123-
maxCompletionTokens: 30_000,
123+
maxCompletionTokens: 2_000_000,
124124
supportedParameters: [
125125
"tools",
126126
"tool_choice",
@@ -131,7 +131,51 @@ export const endpoints = {
131131
"top_p",
132132
"seed",
133133
"logprobs",
134-
"top_logprobs"
134+
"top_logprobs",
135+
"reasoning",
136+
],
137+
ptbEnabled: true,
138+
endpointConfigs: {
139+
"*": {},
140+
},
141+
},
142+
"grok-4-fast-non-reasoning:xai": {
143+
providerModelId: "grok-4-fast-non-reasoning",
144+
provider: "xai",
145+
author: "xai",
146+
pricing: [
147+
{
148+
threshold: 0,
149+
input: 0.0000002, // $0.20 per 1M tokens (up to 128K context)
150+
output: 0.0000005, // $0.50 per 1M tokens (up to 128K context)
151+
web_search: 0.025, // $25.00 per 1K sources
152+
cacheMultipliers: {
153+
cachedInput: 0.25, // $0.05 / $0.20 = 0.25
154+
},
155+
},
156+
{
157+
threshold: 128000, // Above 128K context window
158+
input: 0.0000004, // $0.40 per 1M tokens (over 128K context)
159+
output: 0.000001, // $1.00 per 1M tokens (over 128K context)
160+
web_search: 0.025, // $25.00 per 1K sources
161+
cacheMultipliers: {
162+
cachedInput: 0.125, // $0.05 / $0.40 = 0.125
163+
},
164+
},
165+
],
166+
contextLength: 2_000_000,
167+
maxCompletionTokens: 2_000_000,
168+
supportedParameters: [
169+
"tools",
170+
"tool_choice",
171+
"structured_outputs",
172+
"response_format",
173+
"max_tokens",
174+
"temperature",
175+
"top_p",
176+
"seed",
177+
"logprobs",
178+
"top_logprobs",
135179
],
136180
ptbEnabled: true,
137181
endpointConfigs: {

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,23 @@ export const models = {
2828
author: "xai",
2929
description:
3030
"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,
31+
contextLength: 2000000,
32+
maxOutputTokens: 2000000,
3333
created: "2025-09-01T00:00:00.000Z",
3434
modality: { inputs: ["text", "image"], outputs: ["text"] },
3535
tokenizer: "Grok",
3636
},
37+
"grok-4-fast-non-reasoning": {
38+
name: "xAI Grok 4 Fast Non-Reasoning",
39+
author: "xai",
40+
description:
41+
"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. This non-reasoning model specifically excludes reasoning capabilities.",
42+
contextLength: 2000000,
43+
maxOutputTokens: 2000000,
44+
created: "2025-09-19T00:00:00.000Z",
45+
modality: { inputs: ["text", "image", "audio"], outputs: ["text"] },
46+
tokenizer: "Grok",
47+
},
3748
"grok-3": {
3849
name: "xAI: Grok 3",
3950
author: "xai",

0 commit comments

Comments
 (0)