File tree Expand file tree Collapse file tree 4 files changed +28
-6
lines changed
webview-ui/src/components/settings Expand file tree Collapse file tree 4 files changed +28
-6
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " claude-dev " : patch
3+ ---
4+
5+ Add free grok model
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments