feat: add custom base URL support for Anthropic provider#5295
Closed
satishkc7 wants to merge 1 commit intoMintplex-Labs:masterfrom
Closed
feat: add custom base URL support for Anthropic provider#5295satishkc7 wants to merge 1 commit intoMintplex-Labs:masterfrom
satishkc7 wants to merge 1 commit intoMintplex-Labs:masterfrom
Conversation
Allows users to point the Anthropic provider at self-hosted or Anthropic-compatible backends (e.g. oMLX, Azure AI Foundry) by setting a custom base URL instead of the default api.anthropic.com. Changes: - Pass ANTHROPIC_BASE_URL to the AnthropicAI SDK constructor in both the main client and fetchModelMaxTokens static helper - Register AnthropicBaseURL in updateENV.js with isValidURL validation - Relax the sk-ant- API key format check when a custom base URL is set, since self-hosted backends may use arbitrary key formats - Add Base URL input field in the advanced settings panel of the Anthropic options UI - Document ANTHROPIC_BASE_URL in server and docker .env.example files Closes Mintplex-Labs#5234
Member
|
The Anthropic provider is only for Anthropic intentionally. If we want to support this it has to be through a new Generic like OpenAI - or move Generic OpenAi to just Generic and then have the endpoint be anthropic, openai, or even ollama compatible |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5234
What
Adds an optional
ANTHROPIC_BASE_URLsetting that lets users route the Anthropic provider to any Anthropic-compatible backend instead of the defaultapi.anthropic.com.Why
Self-hosted inference servers (oMLX, Azure AI Foundry, local proxies) expose Anthropic-compatible
/v1/messagesAPIs but have no way to be used with the Anthropic provider today. Users are forced to use Generic OpenAI as a workaround, losing Anthropic-specific UX (model picker, prompt caching, etc.).Changes
server/utils/AiProviders/anthropic/index.jsbaseURLtoAnthropicAIconstructor andfetchModelMaxTokenswhenANTHROPIC_BASE_URLis setserver/utils/helpers/updateENV.jsAnthropicBaseURL→ANTHROPIC_BASE_URLwithisValidURLcheck; relaxsk-ant-key format check when a custom base URL is presentfrontend/src/components/LLMSelection/AnthropicAiOptions/index.jsxserver/.env.example/docker/.env.exampleANTHROPIC_BASE_URLReview notes
ANTHROPIC_BASE_URLis unset — the SDK uses its default endpointsk-ant-) is bypassed only when a custom base URL is configured, since third-party backends accept arbitrary key strings