diff --git a/packages/types/src/providers/xai.ts b/packages/types/src/providers/xai.ts index 3189e593da..d3cdb33f8e 100644 --- a/packages/types/src/providers/xai.ts +++ b/packages/types/src/providers/xai.ts @@ -28,6 +28,15 @@ export const xaiModels = { cacheReadsPrice: 0.75, description: "xAI's Grok-4 model with 256K context window", }, + "grok-4-fast": { + maxTokens: 30_000, + contextWindow: 2_000_000, + supportsImages: false, + supportsPromptCache: false, + inputPrice: 1.0, + outputPrice: 5.0, + description: "xAI's Grok-4 Fast model with 2M context window and SOTA cost-efficiency", + }, "grok-3": { maxTokens: 8192, contextWindow: 131072, diff --git a/src/api/providers/__tests__/xai.spec.ts b/src/api/providers/__tests__/xai.spec.ts index 1d3d4a1509..70777a1938 100644 --- a/src/api/providers/__tests__/xai.spec.ts +++ b/src/api/providers/__tests__/xai.spec.ts @@ -69,6 +69,17 @@ describe("XAIHandler", () => { expect(model.info).toEqual(xaiModels[testModelId]) }) + test("should return grok-4-fast model when specified", () => { + const testModelId = "grok-4-fast" + const handlerWithModel = new XAIHandler({ apiModelId: testModelId }) + const model = handlerWithModel.getModel() + + expect(model.id).toBe(testModelId) + expect(model.info).toEqual(xaiModels[testModelId]) + expect(model.info.contextWindow).toBe(2_000_000) + expect(model.info.maxTokens).toBe(30_000) + }) + it("should include reasoning_effort parameter for mini models", async () => { const miniModelHandler = new XAIHandler({ apiModelId: "grok-3-mini",