Add free grok model (#4115)

* Add free grok model

* Create khaki-cheetahs-tickle.md

* Only change pricing for cline not openrouter provider

* Fixes

* cost to 0 for x-ai provider

---------

Co-authored-by: Cline Evaluation <cline@example.com>
This commit is contained in:
Saoud RizwanandCline Evaluation authored and GitHub committed 2025-06-09 15:01:50 -07:00
1 parent c7e8c7da3e
commit aaa03a37a4
4 files changed
+28 -6

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
Add free grok model
+11 -1
View File
@@ -74,6 +74,16 @@ export class ClineHandler implements ApiHandler {
}
if (!didOutputUsage && chunk.usage) {
// @ts-ignore-next-line
let totalCost = chunk.usage.cost || 0
const modelId = this.getModel().id
const provider = modelId.split("/")[0]
// If provider is x-ai, set totalCost to 0 (we're doing a promo)
if (provider === "x-ai") {
totalCost = 0
}
yield {
type: "usage",
cacheWriteTokens: 0,
@@ -81,7 +91,7 @@ export class ClineHandler implements ApiHandler {
inputTokens: chunk.usage.prompt_tokens || 0,
outputTokens: chunk.usage.completion_tokens || 0,
// @ts-ignore-next-line
totalCost: chunk.usage.cost || 0,
totalCost,
}
didOutputUsage = true
}
@@ -2569,10 +2569,17 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration):
selectedModelInfo: apiConfiguration?.requestyModelInfo || requestyDefaultModelInfo,
}
case "cline":
const openRouterModelId = apiConfiguration?.openRouterModelId || openRouterDefaultModelId
const openRouterModelInfo = apiConfiguration?.openRouterModelInfo || openRouterDefaultModelInfo
return {
selectedProvider: provider,
selectedModelId: apiConfiguration?.openRouterModelId || openRouterDefaultModelId,
selectedModelInfo: apiConfiguration?.openRouterModelInfo || openRouterDefaultModelInfo,
selectedModelId: openRouterModelId,
// TODO: remove this once we have a better way to handle free models on Cline
// Free grok 3 promotion
selectedModelInfo:
openRouterModelId === "x-ai/grok-3-beta"
? { ...openRouterModelInfo, inputPrice: 0, outputPrice: 0 }
: openRouterModelInfo,
}
case "openai":
return {
@@ -52,9 +52,9 @@ const featuredModels = [
label: "Trending",
},
{
id: "openai/gpt-4.1",
description: "1M context window, blazing fast",
label: "New",
id: "x-ai/grok-3-beta",
description: "Latest flagship model from xAI, free for now!",
label: "Free",
},
]