fix: custom endpoint model validation + better /model error messages

- Custom endpoints can serve any model, so skip validation for
  provider='custom' in validate_requested_model(). Previously it
  would reject any model name since there's no static catalog or
  live API to check against.
- Show clear setup instructions when switching to custom endpoint
  without OPENAI_BASE_URL/OPENAI_API_KEY configured.
- Added curated model lists for Nous Portal and OpenAI Codex to
  _PROVIDER_MODELS so /model shows their available models.
This commit is contained in:
teknium1 2026-03-11 23:29:26 -07:00
parent ec2c6dff70
commit 7febdf7208
2 changed files with 14 additions and 1 deletions

View file

@ -276,6 +276,15 @@ def validate_requested_model(
"message": "Model names cannot contain spaces.",
}
# Custom endpoints can serve any model — skip validation
if normalized == "custom":
return {
"accepted": True,
"persist": True,
"recognized": False,
"message": None,
}
# Probe the live API to check if the model actually exists
api_models = fetch_api_models(api_key, base_url)