litellm - ✅(Solved) Fix [Bug]: Unabled to change anthropic base url when adding provider [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#22856Fetched 2026-04-08 00:39:34
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1

Fix Action

Fixed

PR fix notes

PR #22870: fix(ui): add api_base field to Anthropic provider credentials

Description (problem / solution / changelog)

Relevant issues

Fixes #22856

Pre-Submission checklist

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Type

🐛 Bug Fix

Changes

The Anthropic provider in the Admin UI's "Add Credential" form was missing the api_base field, which prevented users from setting a custom base URL for Anthropic API calls (e.g., when using an Anthropic-compatible proxy endpoint).

Root Cause

In litellm/proxy/public_endpoints/provider_create_fields.json, the Anthropic provider only had an api_key credential field defined. Other providers like OpenAI and Anthropic Text already included an api_base field.

Fix

Added an optional api_base text field to the Anthropic provider's credential_fields array in provider_create_fields.json. The field:

  • Is not required (optional)
  • Has a placeholder of https://api.anthropic.com
  • Includes a tooltip explaining its purpose
  • Follows the same pattern used by other providers (OpenAI, Ai21, etc.)

Test

Added test_anthropic_provider_has_api_base_field in tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py to verify the Anthropic provider includes the api_base field with correct properties.

Changed files

  • litellm/proxy/public_endpoints/provider_create_fields.json (modified, +10/-0)
  • tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py (modified, +22/-0)
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

We should be able to change base url of anthropic api call

Steps to Reproduce

  1. Go to admin ui
  2. Add anthropic compatible provider
  3. Unable to change base url

Relevant log output

What part of LiteLLM is this about?

No response

What LiteLLM version are you on ?

v1.81.3

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To enable changing the base URL of the Anthropic API call, we need to modify the provider configuration.

Steps:

  • Update the AnthropicProvider class to include a base_url parameter.
  • Modify the admin UI to allow editing of the base_url field.
  • Update the API call to use the configured base_url.

Example Code:

class AnthropicProvider:
    def __init__(self, base_url, ...):
        self.base_url = base_url
        ...

    def make_api_call(self, ...):
        url = f"{self.base_url}/api/..."
        ...

Verification

To verify the fix, follow these steps:

  • Go to the admin UI and add an Anthropic compatible provider.
  • Edit the provider and change the base URL.
  • Verify that the API call is made to the new base URL.

Extra Tips

  • Ensure that the base_url parameter is properly validated and sanitized to prevent potential security issues.
  • Consider adding a default value for the base_url parameter to simplify the configuration process.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Bug]: Unabled to change anthropic base url when adding provider [1 pull requests, 1 participants]