fix(cli): non-zero /model counts for native OpenAI and direct API rows

This commit is contained in:
XieNBi 2026-04-24 05:41:01 +08:00 committed by Teknium
parent 7f26cea390
commit 4a51ab61eb
3 changed files with 84 additions and 0 deletions

View file

@ -1240,6 +1240,15 @@ def list_authenticated_providers(
if m and m not in models_list:
models_list.append(m)
# Official OpenAI API rows in providers: often have base_url but no
# explicit models: dict — avoid a misleading zero count in /model.
if not models_list:
url_lower = str(api_url).strip().lower()
if "api.openai.com" in url_lower:
fb = curated.get("openai") or []
if fb:
models_list = list(fb)
# Try to probe /v1/models if URL is set (but don't block on it)
# For now just show what we know from config
results.append({