From a43468fd4ecc958bb6ac96cf0748749607b1b525 Mon Sep 17 00:00:00 2001 From: Daniel Onyejesi Date: Tue, 24 Mar 2026 18:17:36 -0400 Subject: [PATCH] Fix Anthropic models: use cross-region inference profiles (us. prefix) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Opus 4.6, Opus 4.5, Sonnet 4.6, Haiku 4.5 do NOT support direct on-demand invocation — they require cross-region inference profile IDs (us.anthropic.* prefix). Updated all affected bedrockIds. Also fixed isAnthropic check to handle us.anthropic.* prefix. Sonnet 4.5, Sonnet 4, 3.5 Haiku also updated to use profiles for consistency (profiles work everywhere, direct IDs are limited). --- src/utils/ai.js | 2 +- src/utils/models.js | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/utils/ai.js b/src/utils/ai.js index 36545eb..362a085 100644 --- a/src/utils/ai.js +++ b/src/utils/ai.js @@ -156,7 +156,7 @@ async function callBedrock(messages, model, temperature, maxTokens) { var BedrockModule = require('@aws-sdk/client-bedrock-runtime'); var modelId = getBedrockModelId(model); - var isAnthropic = modelId.startsWith('anthropic.'); + var isAnthropic = modelId.indexOf('anthropic.') !== -1; // Separate system message from chat messages var systemMsg = ''; diff --git a/src/utils/models.js b/src/utils/models.js index 0ff74a5..1a9896c 100644 --- a/src/utils/models.js +++ b/src/utils/models.js @@ -27,24 +27,25 @@ var OPENROUTER_MODELS = [ ]; var BEDROCK_MODELS = [ - // ── Anthropic vendor model (all verified on-demand from AWS docs 2026-03) ── - // Wide region availability unless noted + // ── Anthropic vendor model (verified from AWS docs 2026-03) ── + // Models marked "profile" require cross-region inference profiles (us. prefix) + // Models marked "on-demand" support direct single-region invocation { id: 'anthropic/vendor-model-opus-4-6', name: 'vendor model Opus 4.6', cost: '~$0.075', tag: 'BEST', category: 'premium', - bedrockId: 'anthropic.agent-config-opus-4-6-v1' }, + bedrockId: 'us.anthropic.agent-config-opus-4-6-v1' }, { id: 'anthropic/vendor-model-opus-4-5', name: 'vendor model Opus 4.5', cost: '~$0.075', tag: 'OPUS', category: 'premium', - bedrockId: 'anthropic.agent-config-opus-4-5-20251101-v1:0' }, + bedrockId: 'us.anthropic.agent-config-opus-4-5-20251101-v1:0' }, { id: 'anthropic/vendor-model-opus-4-1', name: 'vendor model Opus 4.1', cost: '~$0.075', tag: 'MEDICAL', category: 'premium', bedrockId: 'anthropic.agent-config-opus-4-1-20250805-v1:0', regions: ['us-east-1', 'us-east-2', 'us-west-2'] }, { id: 'anthropic/vendor-model-sonnet-4-6', name: 'vendor model Sonnet 4.6', cost: '~$0.015', tag: 'RECOMMENDED', category: 'premium', - bedrockId: 'anthropic.agent-config-sonnet-4-6' }, + bedrockId: 'us.anthropic.agent-config-sonnet-4-6' }, { id: 'anthropic/vendor-model-sonnet-4-5', name: 'vendor model Sonnet 4.5', cost: '~$0.015', tag: 'SMART', category: 'premium', - bedrockId: 'anthropic.agent-config-sonnet-4-5-20250929-v1:0' }, + bedrockId: 'us.anthropic.agent-config-sonnet-4-5-20250929-v1:0' }, { id: 'anthropic/vendor-model-sonnet-4', name: 'vendor model Sonnet 4', cost: '~$0.015', tag: 'SOLID', category: 'premium', - bedrockId: 'anthropic.agent-config-sonnet-4-20250514-v1:0' }, + bedrockId: 'us.anthropic.agent-config-sonnet-4-20250514-v1:0' }, { id: 'anthropic/vendor-model-haiku-4-5', name: 'vendor model Haiku 4.5', cost: '~$0.003', tag: 'FAST', category: 'smart', - bedrockId: 'anthropic.agent-config-haiku-4-5-20251001-v1:0' }, + bedrockId: 'us.anthropic.agent-config-haiku-4-5-20251001-v1:0' }, { id: 'anthropic/vendor-model-3.5-haiku', name: 'vendor model 3.5 Haiku', cost: '~$0.002', tag: 'VALUE', category: 'smart', - bedrockId: 'anthropic.agent-config-3-5-haiku-20241022-v1:0', regions: ['us-west-2', 'us-east-1', 'us-east-2'] }, + bedrockId: 'us.anthropic.agent-config-3-5-haiku-20241022-v1:0' }, // ── Amazon Nova (on-demand, fast + cheap) ── { id: 'amazon/nova-pro', name: 'Amazon Nova Pro', cost: '~$0.008', tag: 'SMART', category: 'smart',