feat: allow custom Anthropic base URLs#1040
Open
tsubasakong wants to merge 1 commit intoItzCrazyKns:masterfrom
Open
feat: allow custom Anthropic base URLs#1040tsubasakong wants to merge 1 commit intoItzCrazyKns:masterfrom
tsubasakong wants to merge 1 commit intoItzCrazyKns:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/lib/models/providers/anthropic/index.ts">
<violation number="1" location="src/lib/models/providers/anthropic/index.ts:119">
P2: `baseURL` is not validated; invalid config values can normalize to malformed URLs and cause runtime fetch failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| return { | ||
| apiKey: String(raw.apiKey), | ||
| baseURL: String(raw.baseURL ?? 'https://api.anthropic.com/v1'), |
Contributor
There was a problem hiding this comment.
P2: baseURL is not validated; invalid config values can normalize to malformed URLs and cause runtime fetch failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/lib/models/providers/anthropic/index.ts, line 119:
<comment>`baseURL` is not validated; invalid config values can normalize to malformed URLs and cause runtime fetch failures.</comment>
<file context>
@@ -97,6 +116,7 @@ class AnthropicProvider extends BaseModelProvider<AnthropicConfig> {
return {
apiKey: String(raw.apiKey),
+ baseURL: String(raw.baseURL ?? 'https://api.anthropic.com/v1'),
};
}
</file context>
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.
Summary
baseURLfield to the Anthropic provider UI/server config/v1Fixes #918.
Summary by cubic
Adds a configurable
baseURLfor the Anthropic provider to support custom Anthropic-compatible endpoints. Normalizes URLs and keepshttps://api.anthropic.com/v1as the default. Fixes #918.New Features
baseURLfield in the provider UI/config with defaulthttps://api.anthropic.com/v1(ANTHROPIC_BASE_URL)./v1is present.baseURL.Migration
ANTHROPIC_BASE_URLor update the provider settings (accepts root URL or/v1).Written for commit a640335. Summary will update on new commits.