Skip to content

Commit aaa03a3

Browse files
saoudrizwanCline Evaluation
andauthored
Add free grok model (RooCodeInc#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 <[email protected]>
1 parent c7e8c7d commit aaa03a3

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
Add free grok model

src/api/providers/cline.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,24 @@ export class ClineHandler implements ApiHandler {
7474
}
7575

7676
if (!didOutputUsage && chunk.usage) {
77+
// @ts-ignore-next-line
78+
let totalCost = chunk.usage.cost || 0
79+
const modelId = this.getModel().id
80+
const provider = modelId.split("/")[0]
81+
82+
// If provider is x-ai, set totalCost to 0 (we're doing a promo)
83+
if (provider === "x-ai") {
84+
totalCost = 0
85+
}
86+
7787
yield {
7888
type: "usage",
7989
cacheWriteTokens: 0,
8090
cacheReadTokens: chunk.usage.prompt_tokens_details?.cached_tokens || 0,
8191
inputTokens: chunk.usage.prompt_tokens || 0,
8292
outputTokens: chunk.usage.completion_tokens || 0,
8393
// @ts-ignore-next-line
84-
totalCost: chunk.usage.cost || 0,
94+
totalCost,
8595
}
8696
didOutputUsage = true
8797
}

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,10 +2569,17 @@ export function normalizeApiConfiguration(apiConfiguration?: ApiConfiguration):
25692569
selectedModelInfo: apiConfiguration?.requestyModelInfo || requestyDefaultModelInfo,
25702570
}
25712571
case "cline":
2572+
const openRouterModelId = apiConfiguration?.openRouterModelId || openRouterDefaultModelId
2573+
const openRouterModelInfo = apiConfiguration?.openRouterModelInfo || openRouterDefaultModelInfo
25722574
return {
25732575
selectedProvider: provider,
2574-
selectedModelId: apiConfiguration?.openRouterModelId || openRouterDefaultModelId,
2575-
selectedModelInfo: apiConfiguration?.openRouterModelInfo || openRouterDefaultModelInfo,
2576+
selectedModelId: openRouterModelId,
2577+
// TODO: remove this once we have a better way to handle free models on Cline
2578+
// Free grok 3 promotion
2579+
selectedModelInfo:
2580+
openRouterModelId === "x-ai/grok-3-beta"
2581+
? { ...openRouterModelInfo, inputPrice: 0, outputPrice: 0 }
2582+
: openRouterModelInfo,
25762583
}
25772584
case "openai":
25782585
return {

webview-ui/src/components/settings/OpenRouterModelPicker.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ const featuredModels = [
5252
label: "Trending",
5353
},
5454
{
55-
id: "openai/gpt-4.1",
56-
description: "1M context window, blazing fast",
57-
label: "New",
55+
id: "x-ai/grok-3-beta",
56+
description: "Latest flagship model from xAI, free for now!",
57+
label: "Free",
5858
},
5959
]
6060

0 commit comments

Comments
 (0)