Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Feat/add watsonx fields (#18569)

kevinpauer705b54bf04fb
diff --git a/litellm/proxy/public_endpoints/provider_create_fields.json b/litellm/proxy/public_endpoints/provider_create_fields.json
index 0e0991dc214..ec1c4619527 100644
--- a/litellm/proxy/public_endpoints/provider_create_fields.json
+++ b/litellm/proxy/public_endpoints/provider_create_fields.json
@@ -2893,7 +2893,7 @@
"key": "api_base",
"label": "API Base",
"placeholder": null,
- "tooltip": null,
+ "tooltip": "Base URL of your WatsonX instance",
"required": false,
"field_type": "text",
"options": null,
@@ -2903,14 +2903,54 @@
"key": "api_key",
"label": "API Key",
"placeholder": null,
- "tooltip": null,
+ "tooltip": "IBM Cloud API key. Required if not using Token or Zen API Key",
+ "required": false,
+ "field_type": "password",
+ "options": null,
+ "default_value": null
+ },
+ {
+ "key": "token",
+ "label": "IAM Token",
+ "placeholder": null,
+ "tooltip": "Pre-generated IAM bearer token. Use instead of API Key if you manage tokens externally",
+ "required": false,
+ "field_type": "password",
+ "options": null,
+ "default_value": null
+ },
+ {
+ "key": "zen_api_key",
+ "label": "Zen API Key",
+ "placeholder": null,
+ "tooltip": "Zen API Key for Cloud Pak for Data deployments. Use instead of API Key for on-premises",
"required": false,
"field_type": "password",
"options": null,
"default_value": null
+ },
+ {
+ "key": "project_id",
+ "label": "Project ID",
+ "placeholder": null,
+ "tooltip": "Optional: Your Watsonx.ai Project ID",
+ "required": false,
+ "field_type": "text",
+ "options": null,
+ "default_value": null
+ },
+ {
+ "key": "space_id",
+ "label": "Deployment Space ID",
+ "placeholder": null,
+ "tooltip": "Optional: Watsonx.ai Deployment Space ID",
+ "required": false,
+ "field_type": "text",
+ "options": null,
+ "default_value": null
}
],
- "default_model_placeholder": "gpt-3.5-turbo"
+ "default_model_placeholder": "watsonx/ibm/granite-3-3-8b-instruct"
},
{
"provider": "WATSONX_TEXT",
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 f6a9b5bddb3..213297fc80a 100644
--- a/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py
+++ b/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py
@@ -78,3 +78,26 @@ def test_get_litellm_model_cost_map_returns_cost_map():
# Check for common cost fields that should be present
assert "input_cost_per_token" in sample_model_data or "output_cost_per_token" in sample_model_data
+
+def test_watsonx_provider_fields():
+ """Test that Watsonx provider has all required credential fields including multiple auth options."""
+ app = FastAPI()
+ app.include_router(router)
+ client = TestClient(app)
+
+ response = client.get("/public/providers/fields")
+ providers = response.json()
+
+ watsonx = next((p for p in providers if p["provider"] == "WATSONX"), None)
+ assert watsonx is not None
+
+ field_keys = [f["key"] for f in watsonx["credential_fields"]]
+ # Core fields
+ assert "api_base" in field_keys
+ assert "project_id" in field_keys
+ assert "space_id" in field_keys
+ # Multiple auth methods supported
+ assert "api_key" in field_keys
+ assert "token" in field_keys
+ assert "zen_api_key" in field_keys
+
diff --git a/ui/litellm-dashboard/src/components/provider_info_helpers.tsx b/ui/litellm-dashboard/src/components/provider_info_helpers.tsx
index b55e607ee99..0eff895addc 100644
--- a/ui/litellm-dashboard/src/components/provider_info_helpers.tsx
+++ b/ui/litellm-dashboard/src/components/provider_info_helpers.tsx
@@ -1,4 +1,3 @@
-
export enum Providers {
A2A_Agent = "A2A Agent",
AIML = "AI/ML API",
@@ -44,6 +43,7 @@ export enum Providers {
Voyage = "Voyage AI",
xAI = "xAI",
SAP = "SAP Generative AI Hub",
+ Watsonx = "Watsonx",
}
export const provider_map: Record<string, string> = {
@@ -90,7 +90,8 @@ export const provider_map: Record<string, string> = {
DeepInfra: "deepinfra",
Hosted_Vllm: "hosted_vllm",
Infinity: "infinity",
- SAP: "sap",
+ SAP: "sap",
+ Watsonx: "watsonx",
};
const asset_logos_folder = "../ui/assets/logos/";
@@ -139,7 +140,7 @@ export const providerLogoMap: Record<string, string> = {
[Providers.JinaAI]: `${asset_logos_folder}jina.png`,
[Providers.VolcEngine]: `${asset_logos_folder}volcengine.png`,
[Providers.DeepInfra]: `${asset_logos_folder}deepinfra.png`,
- [Providers.SAP]: `${asset_logos_folder}sap.png`,
+ [Providers.SAP]: `${asset_logos_folder}sap.png`,
};
export const getProviderLogoAndName = (providerValue: string): { logo: string; displayName: string } => {
@@ -203,6 +204,8 @@ export const getPlaceholder = (selectedProvider: string): string => {
return "fal_ai/fal-ai/flux-pro/v1.1-ultra";
} else if (selectedProvider == Providers.RunwayML) {
return "runwayml/gen4_turbo";
+ } else if (selectedProvider === Providers.Watsonx) {
+ return "watsonx/ibm/granite-3-3-8b-instruct";
} else {
return "gpt-3.5-turbo";
}