Browse Source

fix(claude-code): add opus 4.6 1m model option (#9231)

* fix(claude-code): add opus 4.6 1m model option

* fix(claude-code): support opus[1m] alias and align opus alias

* fix(claude-code): add sonnet[1m] model support
Saoud Rizwan 2 months ago
parent
commit
739d75a

+ 5 - 0
.changeset/chilly-birds-fly.md

@@ -0,0 +1,5 @@
+---
+"cline": patch
+---
+
+Add Claude Code provider support for Claude Opus 4.6 and Sonnet 4.5 1M variants via both full model names and aliases (`opus[1m]`, `sonnet[1m]`), and align the `opus` alias with Opus 4.6.

+ 40 - 0
src/core/api/providers/__tests__/claude-code.test.ts

@@ -236,6 +236,46 @@ describe("ClaudeCodeHandler", () => {
 			model.id.should.equal("claude-sonnet-4-5-20250929")
 		})
 
+		it("should support Opus 4.6 1m model id", () => {
+			const handler = new ClaudeCodeHandler({
+				apiModelId: "claude-opus-4-6[1m]",
+			})
+
+			const model = handler.getModel()
+			model.id.should.equal("claude-opus-4-6[1m]")
+			model.info.contextWindow.should.equal(1_000_000)
+		})
+
+		it("should support Opus 1m alias model id", () => {
+			const handler = new ClaudeCodeHandler({
+				apiModelId: "opus[1m]",
+			})
+
+			const model = handler.getModel()
+			model.id.should.equal("opus[1m]")
+			model.info.contextWindow.should.equal(1_000_000)
+		})
+
+		it("should support Sonnet 1m alias model id", () => {
+			const handler = new ClaudeCodeHandler({
+				apiModelId: "sonnet[1m]",
+			})
+
+			const model = handler.getModel()
+			model.id.should.equal("sonnet[1m]")
+			model.info.contextWindow.should.equal(1_000_000)
+		})
+
+		it("should support Sonnet 4.5 1m model id", () => {
+			const handler = new ClaudeCodeHandler({
+				apiModelId: "claude-sonnet-4-5-20250929[1m]",
+			})
+
+			const model = handler.getModel()
+			model.id.should.equal("claude-sonnet-4-5-20250929[1m]")
+			model.info.contextWindow.should.equal(1_000_000)
+		})
+
 		it("should return default model when not specified", () => {
 			const handler = new ClaudeCodeHandler({})
 

+ 21 - 1
src/shared/api.ts

@@ -341,8 +341,18 @@ export const claudeCodeModels = {
 		supportsImages: false,
 		supportsPromptCache: false,
 	},
+	"sonnet[1m]": {
+		...anthropicModels["claude-sonnet-4-5-20250929:1m"],
+		supportsImages: false,
+		supportsPromptCache: false,
+	},
 	opus: {
-		...anthropicModels["claude-opus-4-1-20250805"],
+		...anthropicModels["claude-opus-4-6"],
+		supportsImages: false,
+		supportsPromptCache: false,
+	},
+	"opus[1m]": {
+		...anthropicModels["claude-opus-4-6:1m"],
 		supportsImages: false,
 		supportsPromptCache: false,
 	},
@@ -356,6 +366,11 @@ export const claudeCodeModels = {
 		supportsImages: false,
 		supportsPromptCache: false,
 	},
+	"claude-sonnet-4-5-20250929[1m]": {
+		...anthropicModels["claude-sonnet-4-5-20250929:1m"],
+		supportsImages: false,
+		supportsPromptCache: false,
+	},
 	"claude-sonnet-4-20250514": {
 		...anthropicModels["claude-sonnet-4-20250514"],
 		supportsImages: false,
@@ -366,6 +381,11 @@ export const claudeCodeModels = {
 		supportsImages: false,
 		supportsPromptCache: false,
 	},
+	"claude-opus-4-6[1m]": {
+		...anthropicModels["claude-opus-4-6:1m"],
+		supportsImages: false,
+		supportsPromptCache: false,
+	},
 	"claude-opus-4-5-20251101": {
 		...anthropicModels["claude-opus-4-5-20251101"],
 		supportsImages: false,

+ 11 - 1
webview-ui/src/components/settings/providers/ClaudeCodeProvider.tsx

@@ -9,6 +9,16 @@ import { normalizeApiConfiguration } from "../utils/providerUtils"
 import { useApiConfigurationHandlers } from "../utils/useApiConfigurationHandlers"
 import { SUPPORTED_ANTHROPIC_THINKING_MODELS } from "./AnthropicProvider"
 
+const SUPPORTED_CLAUDE_CODE_THINKING_MODELS = [
+	...SUPPORTED_ANTHROPIC_THINKING_MODELS,
+	"sonnet",
+	"sonnet[1m]",
+	"claude-sonnet-4-5-20250929[1m]",
+	"claude-opus-4-6[1m]",
+	"opus",
+	"opus[1m]",
+]
+
 /**
  * Props for the ClaudeCodeProvider component
  */
@@ -75,7 +85,7 @@ export const ClaudeCodeProvider = ({ showModelOptions, isPopup, currentMode }: C
 						</p>
 					)}
 
-					{SUPPORTED_ANTHROPIC_THINKING_MODELS.includes(selectedModelId) && (
+					{SUPPORTED_CLAUDE_CODE_THINKING_MODELS.includes(selectedModelId) && (
 						<ThinkingBudgetSlider currentMode={currentMode} maxBudget={selectedModelInfo.thinkingConfig?.maxBudget} />
 					)}