fix: prefer curated model list when live probe returns fewer models (#3856)

The model picker for API-key providers (MiniMax, z.ai, etc.) probes
the live /models endpoint when the curated list has fewer than 8
models. When the live endpoint returns fewer models than the curated
list (e.g. MiniMax's Anthropic-compatible endpoint doesn't list M2.7),
the incomplete live list was used instead.

Now falls back to the curated list when live returns fewer models,
ensuring new models like MiniMax-M2.7 always appear in the picker.
This commit is contained in:
Teknium
2026-03-29 20:55:15 -07:00
committed by GitHub
parent 5e67fc8c40
commit aa389924ad

View File

@@ -2125,7 +2125,7 @@ def _model_flow_api_key_provider(config, provider_id, current_model=""):
api_key_for_probe = existing_key or (get_env_value(key_env) if key_env else "")
live_models = fetch_api_models(api_key_for_probe, effective_base)
if live_models:
if live_models and len(live_models) >= len(curated):
model_list = live_models
print(f" Found {len(model_list)} model(s) from {pconfig.name} API")
else: