Skip to content

Commit a02a0e7

Browse files
committed
feat: add grok-4-fast model to xAI provider
- Added grok-4-fast model configuration to xaiModels in packages/types/src/providers/xai.ts - Added test case to verify grok-4-fast model selection works correctly - Model includes 2M context window and 30K max tokens support Fixes #8474
1 parent 8622d93 commit a02a0e7

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

packages/types/src/providers/xai.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ export const xaiModels = {
2828
cacheReadsPrice: 0.75,
2929
description: "xAI's Grok-4 model with 256K context window",
3030
},
31+
"grok-4-fast": {
32+
maxTokens: 30_000,
33+
contextWindow: 2_000_000,
34+
supportsImages: false,
35+
supportsPromptCache: false,
36+
inputPrice: 1.0,
37+
outputPrice: 5.0,
38+
description: "xAI's Grok-4 Fast model with 2M context window and SOTA cost-efficiency",
39+
},
3140
"grok-3": {
3241
maxTokens: 8192,
3342
contextWindow: 131072,

src/api/providers/__tests__/xai.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ describe("XAIHandler", () => {
6969
expect(model.info).toEqual(xaiModels[testModelId])
7070
})
7171

72+
test("should return grok-4-fast model when specified", () => {
73+
const testModelId = "grok-4-fast"
74+
const handlerWithModel = new XAIHandler({ apiModelId: testModelId })
75+
const model = handlerWithModel.getModel()
76+
77+
expect(model.id).toBe(testModelId)
78+
expect(model.info).toEqual(xaiModels[testModelId])
79+
expect(model.info.contextWindow).toBe(2_000_000)
80+
expect(model.info.maxTokens).toBe(30_000)
81+
})
82+
7283
it("should include reasoning_effort parameter for mini models", async () => {
7384
const miniModelHandler = new XAIHandler({
7485
apiModelId: "grok-3-mini",

0 commit comments

Comments
 (0)