diff --git a/.changeset/khaki-cheetahs-tickle.md b/.changeset/khaki-cheetahs-tickle.md new file mode 100644 index 00000000..5729ccc7 --- /dev/null +++ b/.changeset/khaki-cheetahs-tickle.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Add free grok model diff --git a/src/api/providers/cline.ts b/src/api/providers/cline.ts index 4c0413df..1dd8a9e1 100644 --- a/src/api/providers/cline.ts +++ b/src/api/providers/cline.ts @@ -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 } diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index 41b1439a..13584785 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -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 { diff --git a/webview-ui/src/components/settings/OpenRouterModelPicker.tsx b/webview-ui/src/components/settings/OpenRouterModelPicker.tsx index 205657f7..e47e609f 100644 --- a/webview-ui/src/components/settings/OpenRouterModelPicker.tsx +++ b/webview-ui/src/components/settings/OpenRouterModelPicker.tsx @@ -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", }, ]