From 56648900654d1d910542206bcfeeb851607124d7 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 22 May 2025 10:06:45 -0700 Subject: [PATCH] feat(models): added claude sonnet 4 and opus 4 --- apps/sim/blocks/blocks/agent.ts | 11 +++++++---- apps/sim/providers/anthropic/index.ts | 9 +++++++-- apps/sim/providers/model-capabilities.test.ts | 7 ++++++- apps/sim/providers/model-capabilities.ts | 4 +++- apps/sim/providers/pricing.ts | 12 ++++++++++++ apps/sim/providers/utils.ts | 7 ++++++- 6 files changed, 41 insertions(+), 9 deletions(-) diff --git a/apps/sim/blocks/blocks/agent.ts b/apps/sim/blocks/blocks/agent.ts index 8d4bced8c..965ffd06a 100644 --- a/apps/sim/blocks/blocks/agent.ts +++ b/apps/sim/blocks/blocks/agent.ts @@ -140,8 +140,10 @@ export const AgentBlock: BlockConfig = { 'o4-mini', 'gpt-4.1', // Claude models - 'claude-3-5-sonnet-20240620', + 'claude-sonnet-4-20250514', + 'claude-opus-4-20250514', 'claude-3-7-sonnet-20250219', + 'claude-3-5-sonnet-20240620', ], not: true, // Show for all models EXCEPT those listed } @@ -237,10 +239,11 @@ export const AgentBlock: BlockConfig = { context: { type: 'string', required: false }, model: { type: 'string', required: true }, apiKey: { type: 'string', required: true }, - messages: { - type: 'json', + messages: { + type: 'json', required: false, - description: 'Array of message objects with role and content fields for advanced chat history control.' + description: + 'Array of message objects with role and content fields for advanced chat history control.', }, responseFormat: { type: 'json', diff --git a/apps/sim/providers/anthropic/index.ts b/apps/sim/providers/anthropic/index.ts index cd5896e9c..077bc30c5 100644 --- a/apps/sim/providers/anthropic/index.ts +++ b/apps/sim/providers/anthropic/index.ts @@ -36,8 +36,13 @@ export const anthropicProvider: ProviderConfig = { name: 'Anthropic', description: "Anthropic's Claude models", version: '1.0.0', - models: ['claude-3-5-sonnet-20240620', 'claude-3-7-sonnet-20250219'], - defaultModel: 'claude-3-7-sonnet-20250219', + models: [ + 'claude-sonnet-4-20250514', + 'claude-opus-4-20250514', + 'claude-3-7-sonnet-20250219', + 'claude-3-5-sonnet-20240620', + ], + defaultModel: 'claude-sonnet-4-20250514', executeRequest: async ( request: ProviderRequest diff --git a/apps/sim/providers/model-capabilities.test.ts b/apps/sim/providers/model-capabilities.test.ts index 6d462c7a0..3b7408645 100644 --- a/apps/sim/providers/model-capabilities.test.ts +++ b/apps/sim/providers/model-capabilities.test.ts @@ -28,6 +28,9 @@ describe('supportsTemperature', () => { const supportedModels = [ 'gpt-4o', 'gemini-2.5-flash-preview-04-17', + 'claude-sonnet-4-20250514', + 'claude-opus-4-20250514', + 'claude-3-7-sonnet-20250219', 'claude-3-5-sonnet-20240620', `grok-3-latest`, `grok-3-fast-latest`, @@ -58,8 +61,10 @@ describe('getMaxTemperature', () => { it('should return 1 for models with temperature range 0-1', () => { const models = [ - 'claude-3-5-sonnet-20240620', + 'claude-sonnet-4-20250514', + 'claude-opus-4-20250514', 'claude-3-7-sonnet-20250219', + 'claude-3-5-sonnet-20240620', 'grok-3-latest', 'grok-3-fast-latest', ] diff --git a/apps/sim/providers/model-capabilities.ts b/apps/sim/providers/model-capabilities.ts index 21ac00bc5..dd3a87cb1 100644 --- a/apps/sim/providers/model-capabilities.ts +++ b/apps/sim/providers/model-capabilities.ts @@ -17,8 +17,10 @@ export const MODELS_TEMP_RANGE_0_2 = [ // Models that support temperature with range 0-1 export const MODELS_TEMP_RANGE_0_1 = [ // Anthropic models - 'claude-3-5-sonnet-20240620', + 'claude-sonnet-4-20250514', + 'claude-opus-4-20250514', 'claude-3-7-sonnet-20250219', + 'claude-3-5-sonnet-20240620', // xAI models 'grok-3-latest', 'grok-3-fast-latest', diff --git a/apps/sim/providers/pricing.ts b/apps/sim/providers/pricing.ts index 5f49f645a..1b5f0cd60 100644 --- a/apps/sim/providers/pricing.ts +++ b/apps/sim/providers/pricing.ts @@ -52,6 +52,18 @@ const modelPricing: ModelPricingMap = { output: 15.0, updatedAt: '2025-03-21', }, + 'claude-sonnet-4-20250514': { + input: 3.0, + cachedInput: 1.5, + output: 15.0, + updatedAt: '2025-05-22', + }, + 'claude-opus-4-20250514': { + input: 15.0, + cachedInput: 7.5, + output: 75.0, + updatedAt: '2025-05-22', + }, // Google Models 'gemini-2.5-pro-exp-03-25': { diff --git a/apps/sim/providers/utils.ts b/apps/sim/providers/utils.ts index abd4f0fa0..1cf58e8fb 100644 --- a/apps/sim/providers/utils.ts +++ b/apps/sim/providers/utils.ts @@ -34,7 +34,12 @@ export const providers: Record< }, anthropic: { ...anthropicProvider, - models: ['claude-3-5-sonnet-20240620', 'claude-3-7-sonnet-20250219'], + models: [ + 'claude-sonnet-4-20250514', + 'claude-opus-4-20250514', + 'claude-3-7-sonnet-20250219', + 'claude-3-5-sonnet-20240620', + ], computerUseModels: ['claude-3-5-sonnet-20240620', 'claude-3-7-sonnet-20250219'], modelPatterns: [/^claude/], },