From 70ce02faf44267a9c5cf6ffbe79bebd6b5abe0ec Mon Sep 17 00:00:00 2001 From: buua436 <66937541+buua436@users.noreply.github.com> Date: Fri, 19 Sep 2025 19:06:14 +0800 Subject: [PATCH] Feat: add support for Anthropic third-party API (#10173) ### What problem does this PR solve? issue: [Bug]: anthropic model have not baseurl selecting,need add #8546 change: This PR adds support for using Anthropic models through a third-party API by allowing a custom base_url. It ensures compatibility with both the official Anthropic endpoint and external providers. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- rag/llm/__init__.py | 1 + .../setting-model/api-key-modal/index.tsx | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/rag/llm/__init__.py b/rag/llm/__init__.py index d91f57736..8b6d40fdd 100644 --- a/rag/llm/__init__.py +++ b/rag/llm/__init__.py @@ -68,6 +68,7 @@ FACTORY_DEFAULT_BASE_URL = { SupportedLiteLLMProvider.Lingyi_AI: "https://api.lingyiwanwu.com/v1", SupportedLiteLLMProvider.GiteeAI: "https://ai.gitee.com/v1/", SupportedLiteLLMProvider.AI_302: "https://api.302.ai/v1", + SupportedLiteLLMProvider.Anthropic: "https://api.anthropic.com/", } diff --git a/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx b/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx index d08223646..999f422c2 100644 --- a/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/api-key-modal/index.tsx @@ -89,6 +89,18 @@ const ApiKeyModal = ({ /> )} + {llmFactory?.toLowerCase() === 'Anthropic'.toLowerCase() && ( + + label={t('baseUrl')} + name="base_url" + tooltip={t('baseUrlTip')} + > + + + )} {llmFactory?.toLowerCase() === 'Minimax'.toLowerCase() && ( label={'Group ID'} name="group_id">