From 651ba446bf35ee2aff2ba2bb402aa5579c74e9df Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Fri, 3 Oct 2025 21:40:59 +0700 Subject: [PATCH] chore: migration base_url anthropic --- web-app/src/hooks/useModelProvider.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/web-app/src/hooks/useModelProvider.ts b/web-app/src/hooks/useModelProvider.ts index a0b5a96ce..484b08f97 100644 --- a/web-app/src/hooks/useModelProvider.ts +++ b/web-app/src/hooks/useModelProvider.ts @@ -320,9 +320,32 @@ export const useModelProvider = create()( }) } + if (version <= 3 && state?.providers) { + state.providers.forEach((provider) => { + // Migrate Anthropic provider base URL and add custom headers + if (provider.provider === 'anthropic') { + if (provider.base_url === 'https://api.anthropic.com') { + provider.base_url = 'https://api.anthropic.com/v1' + } + if (!provider.custom_header) { + provider.custom_header = [ + { + header: 'anthropic-version', + value: '2023-06-01', + }, + { + header: 'anthropic-dangerous-direct-browser-access', + value: 'true', + }, + ] + } + } + }) + } + return state }, - version: 3, + version: 4, } ) )