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 <noreply@anthropic.com>
This commit is contained in:
hedging8563 2026-10-02 09:09:55 +08:00
parent 4787c048a9
commit 9da5e2d4be
2 changed files with 28 additions and 4 deletions

View file

@ -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")

View file

@ -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",