Skip to content

feat: allow custom Anthropic base URLs#1040

Open
tsubasakong wants to merge 1 commit intoItzCrazyKns:masterfrom
tsubasakong:lucas/minimax-anthropic-baseurl-918
Open

feat: allow custom Anthropic base URLs#1040
tsubasakong wants to merge 1 commit intoItzCrazyKns:masterfrom
tsubasakong:lucas/minimax-anthropic-baseurl-918

Conversation

@tsubasakong
Copy link

@tsubasakong tsubasakong commented Mar 8, 2026

Summary

  • add a configurable baseURL field to the Anthropic provider UI/server config
  • normalize custom Anthropic-compatible endpoints so users can enter either the root URL or /v1
  • keep the official Anthropic endpoint as the backward-compatible default for existing configs

Fixes #918.


Summary by cubic

Adds a configurable baseURL for the Anthropic provider to support custom Anthropic-compatible endpoints. Normalizes URLs and keeps https://api.anthropic.com/v1 as the default. Fixes #918.

  • New Features

    • Adds baseURL field in the provider UI/config with default https://api.anthropic.com/v1 (ANTHROPIC_BASE_URL).
    • Normalizes user input: trims trailing slashes and ensures /v1 is present.
    • All Anthropic requests (model listing and LLM calls) now use the configured baseURL.
  • Migration

    • No action needed for existing setups; default endpoint remains unchanged.
    • To use a custom proxy, set ANTHROPIC_BASE_URL or update the provider settings (accepts root URL or /v1).

Written for commit a640335. Summary will update on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'),
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MiniMax M2 api endpoint request

1 participant