Browse Source

Add Claude Haiku 4.5 (#8673)

Daniel 2 months ago
parent
commit
e5216c689e

+ 13 - 0
packages/types/src/providers/anthropic.ts

@@ -139,6 +139,19 @@ export const anthropicModels = {
 		cacheWritesPrice: 0.3,
 		cacheReadsPrice: 0.03,
 	},
+	"claude-haiku-4-5-20251001": {
+		maxTokens: 64_000,
+		contextWindow: 200_000,
+		supportsImages: true,
+		supportsPromptCache: true,
+		inputPrice: 1.0,
+		outputPrice: 5.0,
+		cacheWritesPrice: 1.25,
+		cacheReadsPrice: 0.1,
+		supportsReasoningBudget: true,
+		description:
+			"Claude Haiku 4.5 delivers near-frontier intelligence at lightning speeds with extended thinking, vision, and multilingual support.",
+	},
 } as const satisfies Record<string, ModelInfo>
 
 export const ANTHROPIC_DEFAULT_MAX_TOKENS = 8192

+ 14 - 0
packages/types/src/providers/bedrock.ts

@@ -169,6 +169,20 @@ export const bedrockModels = {
 		maxCachePoints: 4,
 		cachableFields: ["system", "messages", "tools"],
 	},
+	"anthropic.claude-haiku-4-5-20251001-v1:0": {
+		maxTokens: 8192,
+		contextWindow: 200_000,
+		supportsImages: true,
+		supportsPromptCache: true,
+		supportsReasoningBudget: true,
+		inputPrice: 1.0,
+		outputPrice: 5.0,
+		cacheWritesPrice: 1.25, // 5m cache writes
+		cacheReadsPrice: 0.1, // cache hits / refreshes
+		minTokensPerCachePoint: 2048,
+		maxCachePoints: 4,
+		cachableFields: ["system", "messages", "tools"],
+	},
 	"anthropic.claude-3-5-sonnet-20240620-v1:0": {
 		maxTokens: 8192,
 		contextWindow: 200_000,

+ 8 - 0
packages/types/src/providers/claude-code.ts

@@ -105,4 +105,12 @@ export const claudeCodeModels = {
 		supportsReasoningBudget: false,
 		requiredReasoningBudget: false,
 	},
+	"claude-haiku-4-5-20251001": {
+		...anthropicModels["claude-haiku-4-5-20251001"],
+		supportsImages: false,
+		supportsPromptCache: true, // Claude Code does report cache tokens
+		supportsReasoningEffort: false,
+		supportsReasoningBudget: false,
+		requiredReasoningBudget: false,
+	},
 } as const satisfies Record<string, ModelInfo>

+ 1 - 0
packages/types/src/providers/openrouter.ts

@@ -84,6 +84,7 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
 	"anthropic/claude-opus-4.1",
 	"anthropic/claude-sonnet-4",
 	"anthropic/claude-sonnet-4.5",
+	"anthropic/claude-haiku-4.5",
 	"google/gemini-2.5-pro-preview",
 	"google/gemini-2.5-pro",
 	"google/gemini-2.5-flash-preview-05-20",

+ 11 - 0
packages/types/src/providers/vertex.ts

@@ -187,6 +187,17 @@ export const vertexModels = {
 		cacheReadsPrice: 0.3,
 		supportsReasoningBudget: true,
 	},
+	"claude-haiku-4-5@20251001": {
+		maxTokens: 8192,
+		contextWindow: 200_000,
+		supportsImages: true,
+		supportsPromptCache: true,
+		inputPrice: 1.0,
+		outputPrice: 5.0,
+		cacheWritesPrice: 1.25,
+		cacheReadsPrice: 0.1,
+		supportsReasoningBudget: true,
+	},
 	"claude-opus-4-1@20250805": {
 		maxTokens: 8192,
 		contextWindow: 200_000,

+ 2 - 0
src/api/providers/anthropic.ts

@@ -62,6 +62,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
 			case "claude-3-5-sonnet-20241022":
 			case "claude-3-5-haiku-20241022":
 			case "claude-3-opus-20240229":
+			case "claude-haiku-4-5-20251001":
 			case "claude-3-haiku-20240307": {
 				/**
 				 * The latest message will be the new user message, one before
@@ -122,6 +123,7 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
 							case "claude-3-5-sonnet-20241022":
 							case "claude-3-5-haiku-20241022":
 							case "claude-3-opus-20240229":
+							case "claude-haiku-4-5-20251001":
 							case "claude-3-haiku-20240307":
 								betas.push("prompt-caching-2024-07-31")
 								return { headers: { "anthropic-beta": betas.join(",") } }

+ 1 - 0
src/api/providers/fetchers/__tests__/openrouter.spec.ts

@@ -137,6 +137,7 @@ describe("OpenRouter API", () => {
 				"google/gemini-2.5-pro",
 				"anthropic/claude-opus-4.1", // Not yet available in OpenRouter API
 				"anthropic/claude-sonnet-4.5", // Not yet available in OpenRouter API
+				"anthropic/claude-haiku-4.5", // Not yet available in OpenRouter API
 			])
 
 			const expectedReasoningBudgetModels = Array.from(OPEN_ROUTER_REASONING_BUDGET_MODELS)

+ 7 - 0
src/api/providers/fetchers/openrouter.ts

@@ -253,6 +253,13 @@ export const parseOpenRouterModel = ({
 		modelInfo.maxTokens = anthropicModels["claude-opus-4-1-20250805"].maxTokens
 	}
 
+	// Ensure correct reasoning handling for Claude Haiku 4.5 on OpenRouter
+	// Use budget control and disable effort-based reasoning fallback
+	if (id === "anthropic/claude-haiku-4.5") {
+		modelInfo.supportsReasoningBudget = true
+		modelInfo.supportsReasoningEffort = false
+	}
+
 	// Set horizon-alpha model to 32k max tokens
 	if (id === "openrouter/horizon-alpha") {
 		modelInfo.maxTokens = 32768