diff --git a/litellm/proxy/public_endpoints/provider_create_fields.json b/litellm/proxy/public_endpoints/provider_create_fields.json index b24f3df627..98ec977b07 100644 --- a/litellm/proxy/public_endpoints/provider_create_fields.json +++ b/litellm/proxy/public_endpoints/provider_create_fields.json @@ -214,6 +214,16 @@ "provider_display_name": "Anthropic", "litellm_provider": "anthropic", "credential_fields": [ + { + "key": "api_base", + "label": "API Base", + "placeholder": null, + "tooltip": "Optional. Override the upstream Anthropic API URL. Defaults to https://api.anthropic.com.", + "required": false, + "field_type": "text", + "options": null, + "default_value": null + }, { "key": "api_key", "label": "API Key", diff --git a/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py b/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py index dc6def48fc..ced5e2f43b 100644 --- a/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py +++ b/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py @@ -164,6 +164,23 @@ def test_anthropic_provider_fields_support_byok(): assert fields_by_key["api_key"].get("tooltip"), ( "Anthropic api_key must have a tooltip explaining the BYOK use case." ) + assert "api_base" in fields_by_key, ( + "Anthropic provider form must expose api_base so cloud customers " + "can override the upstream URL without env var access." + ) + api_base_field = fields_by_key["api_base"] + assert api_base_field["required"] is False + assert api_base_field["field_type"] == "text" + assert api_base_field.get("tooltip"), ( + "api_base should have a tooltip explaining it is optional." + ) + + # UI forms render fields in credential_fields order; api_base should come first + # so an admin sees the URL override before the key field. + field_order = [f["key"] for f in anthropic["credential_fields"]] + assert field_order.index("api_base") < field_order.index("api_key"), ( + "api_base must appear before api_key in credential_fields (matches AI21 and ANTHROPIC_TEXT convention)." + ) def test_public_model_hub_with_healthy_model():