From ab87d477079d1c7cd5923910b392eeff9c08e1c9 Mon Sep 17 00:00:00 2001 From: Jim Aldon D'Souza Date: Sat, 12 Sep 2026 17:10:50 -0700 Subject: [PATCH 1/2] fix(ui): register tencent in the Add Model provider dropdown The Add Model provider dropdown is driven by the proxy's /public/providers/fields endpoint, which serves provider_create_fields.json. Tencent was frozen in the test's ADD_MODEL_UNLISTED_PROVIDERS set, so it never appeared in the dropdown. Add a Tencent entry (optional api_base + required api_key, matching TENCENT_API_BASE/TENCENT_API_KEY) and unfreeze it in the backend test. Register Tencent in the UI Providers enum, provider_map, and placeholder map so the dropdown resolves the display name and model placeholder. --- .../provider_create_fields.json | 28 ++++++++++++++++ .../public_endpoints/test_public_endpoints.py | 33 ++++++++++++++++++- .../components/provider_info_helpers.test.tsx | 5 +++ .../src/components/provider_info_helpers.tsx | 3 ++ 4 files changed, 68 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/public_endpoints/provider_create_fields.json b/litellm/proxy/public_endpoints/provider_create_fields.json index cd781abee26..83086a64da2 100644 --- a/litellm/proxy/public_endpoints/provider_create_fields.json +++ b/litellm/proxy/public_endpoints/provider_create_fields.json @@ -2925,6 +2925,34 @@ ], "default_model_placeholder": "soniox/stt-async-v5" }, + { + "provider": "Tencent", + "provider_display_name": "Tencent", + "litellm_provider": "tencent", + "credential_fields": [ + { + "key": "api_base", + "label": "API Base", + "placeholder": "https://tokenhub-intl.tencentcloudmaas.com/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": "tencent/deepseek-v4-pro" + }, { "provider": "TEXT_COMPLETION_CODESTRAL", "provider_display_name": "Text-Completion-Codestral", 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 0d82ed778f5..2dba70c7712 100644 --- a/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py +++ b/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py @@ -346,6 +346,38 @@ def test_chatgpt_provider_fields(): assert chatgpt["credential_fields"] == [] +def test_tencent_provider_fields(): + """Tencent TokenHub must be selectable in the Add Model flow. + + The dropdown is driven entirely by /public/providers/fields, so a missing + entry means Tencent cannot be added through the UI at all. The credential + fields must match what the backend honors: a required api_key (TENCENT_API_KEY) + and an optional api_base override (TENCENT_API_BASE). + """ + app_instance = FastAPI() + app_instance.include_router(router) + test_client = TestClient(app_instance) + + response = test_client.get("/public/providers/fields") + assert response.status_code == 200 + providers = response.json() + + tencent = next((p for p in providers if p["provider"] == "Tencent"), None) + assert tencent is not None, "Tencent provider entry not found" + + assert tencent["provider_display_name"] == "Tencent" + assert tencent["litellm_provider"] == LlmProviders.TENCENT.value + assert tencent["default_model_placeholder"].startswith("tencent/") + + fields_by_key = {f["key"]: f for f in tencent["credential_fields"]} + + assert fields_by_key["api_key"]["required"] is True + assert fields_by_key["api_key"]["field_type"] == "password" + + assert fields_by_key["api_base"]["field_type"] == "text" + assert fields_by_key["api_base"]["required"] is False + + ADD_MODEL_UNLISTED_PROVIDERS: Final = frozenset( { "a2a", @@ -381,7 +413,6 @@ ADD_MODEL_UNLISTED_PROVIDERS: Final = frozenset( "scaleway", "stability", "synthetic", - "tencent", "tensormesh", "text-completion-inception", "valkey", diff --git a/ui/litellm-dashboard/src/components/provider_info_helpers.test.tsx b/ui/litellm-dashboard/src/components/provider_info_helpers.test.tsx index 4c68e302267..ac7324a4776 100644 --- a/ui/litellm-dashboard/src/components/provider_info_helpers.test.tsx +++ b/ui/litellm-dashboard/src/components/provider_info_helpers.test.tsx @@ -176,6 +176,7 @@ describe("provider_info_helpers", () => { Providers.PETALS, Providers.PG_VECTOR, Providers.PREDIBASE, + Providers.Tencent, Providers.WANDB, Providers.ZAI, ]; @@ -286,6 +287,10 @@ describe("provider_info_helpers", () => { expect(getPlaceholder("CHATGPT")).toBe("chatgpt/gpt-5.4"); }); + it("should return a tencent/ placeholder for the Tencent provider", () => { + expect(getPlaceholder(Providers.Tencent)).toBe("tencent/deepseek-v4-pro"); + }); + it("should return default gpt-3.5-turbo placeholder for unknown provider", () => { expect(getPlaceholder("UnknownProvider" as any)).toBe("gpt-3.5-turbo"); }); diff --git a/ui/litellm-dashboard/src/components/provider_info_helpers.tsx b/ui/litellm-dashboard/src/components/provider_info_helpers.tsx index de83cd00790..e5be8bc1d11 100644 --- a/ui/litellm-dashboard/src/components/provider_info_helpers.tsx +++ b/ui/litellm-dashboard/src/components/provider_info_helpers.tsx @@ -163,6 +163,7 @@ export enum Providers { Snowflake = "Snowflake", Soniox = "Soniox", TEXT_COMPLETION_CODESTRAL = "Text-Completion-Codestral", + Tencent = "Tencent", TogetherAI = "TogetherAI", TOPAZ = "Topaz", Triton = "Triton", @@ -279,6 +280,7 @@ export const provider_map: Record = { Snowflake: "snowflake", Soniox: "soniox", TEXT_COMPLETION_CODESTRAL: "text-completion-codestral", + Tencent: "tencent", TogetherAI: "together_ai", TOPAZ: "topaz", Triton: "triton", @@ -441,6 +443,7 @@ const providerPlaceholderMap: Partial> = { [Providers.SageMaker]: "sagemaker/jumpstart-dft-meta-textgeneration-llama-2-7b", [Providers.SCX_AI]: "scx-ai/GLM-5.2", [Providers.Snowflake]: "snowflake/mistral-7b", + [Providers.Tencent]: "tencent/deepseek-v4-pro", [Providers.Vertex_AI]: "gemini-pro", [Providers.VolcEngine]: "volcengine/", [Providers.Voyage]: "voyage/", From da891158ab6683abab3b56f62ec8d39cbfd1fb15 Mon Sep 17 00:00:00 2001 From: Jim Aldon D'Souza Date: Sat, 12 Sep 2026 17:25:20 -0700 Subject: [PATCH 2/2] fix(tencent): drop test docstring to satisfy comment policy --- .../proxy/public_endpoints/test_public_endpoints.py | 7 ------- 1 file changed, 7 deletions(-) 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 2dba70c7712..9cf7571f212 100644 --- a/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py +++ b/tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py @@ -347,13 +347,6 @@ def test_chatgpt_provider_fields(): def test_tencent_provider_fields(): - """Tencent TokenHub must be selectable in the Add Model flow. - - The dropdown is driven entirely by /public/providers/fields, so a missing - entry means Tencent cannot be added through the UI at all. The credential - fields must match what the backend honors: a required api_key (TENCENT_API_KEY) - and an optional api_base override (TENCENT_API_BASE). - """ app_instance = FastAPI() app_instance.include_router(router) test_client = TestClient(app_instance)