From 9da5e2d4befd0f4b7395d572fde007f0db5d8550 Mon Sep 17 00:00:00 2001 From: hedging8563 Date: Fri, 2 Oct 2026 09:09:55 +0800 Subject: [PATCH] fix(tokenlab): list the provider in Add Model and use the shared base-url lookup TokenLab gets an entry in provider_create_fields.json, which the Add Model dropdown test requires for every backend provider. The explicit endpoint branch in get_llm_provider is removed: JSONProviderRegistry.get_by_base_url already resolves a JSON-configured provider from its base url, and the removed branch declared a Final inside the loop, which the type gate counts. Co-Authored-By: Claude Opus 5.5 --- .../get_llm_provider_logic.py | 4 --- .../provider_create_fields.json | 28 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.py index b01aa1a6b2c..d4642ae2aad 100644 --- a/litellm/litellm_core_utils/get_llm_provider_logic.py +++ b/litellm/litellm_core_utils/get_llm_provider_logic.py @@ -389,10 +389,6 @@ def get_llm_provider( elif endpoint == "https://api.inference.wandb.ai/v1": custom_llm_provider = "wandb" dynamic_api_key = get_secret_str("WANDB_API_KEY") - elif endpoint == "https://api.tokenlab.sh/v1": - custom_llm_provider = "tokenlab" - tokenlab_config: Final = JSONProviderRegistry.get("tokenlab") - dynamic_api_key = get_secret_str(tokenlab_config.api_key_env) if tokenlab_config else None elif endpoint == "https://pinstripes.io/v1": custom_llm_provider = "pinstripes" dynamic_api_key = get_secret_str("PINSTRIPES_API_KEY") diff --git a/litellm/proxy/public_endpoints/provider_create_fields.json b/litellm/proxy/public_endpoints/provider_create_fields.json index 11d2ff61b95..3e71a3ff243 100644 --- a/litellm/proxy/public_endpoints/provider_create_fields.json +++ b/litellm/proxy/public_endpoints/provider_create_fields.json @@ -3207,6 +3207,34 @@ ], "default_model_placeholder": "gpt-3.5-turbo" }, + { + "provider": "TOKENLAB", + "provider_display_name": "TokenLab", + "litellm_provider": "tokenlab", + "credential_fields": [ + { + "key": "api_base", + "label": "API Base", + "placeholder": "https://api.tokenlab.sh/v1", + "tooltip": null, + "required": false, + "field_type": "text", + "options": null, + "default_value": null + }, + { + "key": "api_key", + "label": "API Key", + "placeholder": null, + "tooltip": null, + "required": true, + "field_type": "password", + "options": null, + "default_value": null + } + ], + "default_model_placeholder": "tokenlab/gpt-5.5" + }, { "provider": "TOPAZ", "provider_display_name": "Topaz",