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
This commit is contained in:
Roo Code 2025-10-02 21:12:28 +00:00
parent 8622d93f59
commit a02a0e7db9
2 changed files with 20 additions and 0 deletions

View file

@ -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,

View file

@ -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",