Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat: add Claude Sonnet 4.5 model to AI chat models (#9476)

YuTengjinga30a65cd4c8e
diff --git a/packages/const/src/models.ts b/packages/const/src/models.ts
index 6d5773cf8e0..3ba32f47e01 100644
--- a/packages/const/src/models.ts
+++ b/packages/const/src/models.ts
@@ -41,6 +41,9 @@ export const responsesAPIModels = new Set([
* models support context caching
*/
export const contextCachingModels = new Set([
+ 'claude-sonnet-4-5-latest',
+ 'claude-sonnet-4-5-20250929',
+ 'anthropic/claude-sonnet-4.5',
'claude-opus-4-latest',
'claude-opus-4-20250514',
'claude-sonnet-4-latest',
@@ -59,6 +62,9 @@ export const thinkingWithToolClaudeModels = new Set([
'claude-opus-4-20250514',
'claude-sonnet-4-latest',
'claude-sonnet-4-20250514',
+ 'claude-sonnet-4-5-latest',
+ 'claude-sonnet-4-5-20250929',
+ 'anthropic/claude-sonnet-4.5',
'claude-3-7-sonnet-latest',
'claude-3-7-sonnet-20250219',
]);
diff --git a/packages/model-bank/src/aiModels/anthropic.ts b/packages/model-bank/src/aiModels/anthropic.ts
index 399181559b3..d62c90bb322 100644
--- a/packages/model-bank/src/aiModels/anthropic.ts
+++ b/packages/model-bank/src/aiModels/anthropic.ts
@@ -1,6 +1,34 @@
import { AIChatModelCard } from '../types/aiModel';
const anthropicChatModels: AIChatModelCard[] = [
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 200_000,
+ description: 'Claude Sonnet 4.5 是 Anthropic 迄今为止最智能的模型。',
+ displayName: 'Claude Sonnet 4.5',
+ enabled: true,
+ id: 'claude-sonnet-4-5-20250929',
+ maxOutput: 64_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput_cacheWrite', rate: 3.75, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-09-30',
+ settings: {
+ extendParams: ['disableContextCaching', 'enableReasoning', 'reasoningBudgetToken'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/openrouter.ts b/packages/model-bank/src/aiModels/openrouter.ts
index 111b46e4056..900519da86b 100644
--- a/packages/model-bank/src/aiModels/openrouter.ts
+++ b/packages/model-bank/src/aiModels/openrouter.ts
@@ -694,6 +694,34 @@ const openrouterChatModels: AIChatModelCard[] = [
id: 'deepseek/deepseek-chat-v3-0324:free',
type: 'chat',
},
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 200_000,
+ description: 'Claude Sonnet 4.5 是 Anthropic 迄今为止最智能的模型。',
+ displayName: 'Claude Sonnet 4.5',
+ enabled: true,
+ id: 'anthropic/claude-sonnet-4.5',
+ maxOutput: 64_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput_cacheWrite', rate: 3.75, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-09-30',
+ settings: {
+ extendParams: ['disableContextCaching', 'enableReasoning', 'reasoningBudgetToken'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
diff --git a/packages/model-runtime/src/providers/anthropic/index.ts b/packages/model-runtime/src/providers/anthropic/index.ts
index 996b4b5f9da..ae45f826f21 100644
--- a/packages/model-runtime/src/providers/anthropic/index.ts
+++ b/packages/model-runtime/src/providers/anthropic/index.ts
@@ -30,8 +30,12 @@ type anthropicTools = Anthropic.Tool | Anthropic.WebSearchTool20250305;
const modelsWithSmallContextWindow = new Set(['claude-3-opus-20240229', 'claude-3-haiku-20240307']);
-// Opus 4.1 models that don't allow both temperature and top_p parameters
-const opus41Models = new Set(['claude-opus-4-1', 'claude-opus-4-1-20250805']);
+// models after Opus 4.1 that don't allow both temperature and top_p parameters
+const modelsWithTempAndTopPConflict = new Set([
+ 'claude-opus-4-1',
+ 'claude-opus-4-1-20250805',
+ 'claude-sonnet-4-5-20250929',
+]);
const DEFAULT_BASE_URL = 'https://api.anthropic.com';
@@ -204,7 +208,7 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
}
// For Opus 4.1 models, we can only set either temperature OR top_p, not both
- const isOpus41Model = opus41Models.has(model);
+ const isTempAndTopPConflict = modelsWithTempAndTopPConflict.has(model);
const shouldSetTemperature = payload.temperature !== undefined;
return {
@@ -215,7 +219,7 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
model,
system: systemPrompts,
// For Opus 4.1 models: prefer temperature over top_p if both are provided
- temperature: isOpus41Model
+ temperature: isTempAndTopPConflict
? shouldSetTemperature
? temperature / 2
: undefined
@@ -224,7 +228,7 @@ export class LobeAnthropicAI implements LobeRuntimeAI {
: undefined,
tools: postTools,
// For Opus 4.1 models: only set top_p if temperature is not set
- top_p: isOpus41Model ? (shouldSetTemperature ? undefined : top_p) : top_p,
+ top_p: isTempAndTopPConflict ? (shouldSetTemperature ? undefined : top_p) : top_p,
} satisfies Anthropic.MessageCreateParams;
}