fix: disable OpenRouter discovery when model list is explicit
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details

This commit is contained in:
juvenal.diaz 2026-10-08 15:47:15 -06:00
parent 6bab4d9684
commit 6ac127b9f6
1 changed files with 5 additions and 1 deletions

View File

@ -17,8 +17,10 @@ OMNIROUTE_SMART_MODEL_TARGET="${LAB_AI_STACK_SMART_MODEL_TARGET:-2}"
DEFAULT_OPENROUTER_MODELS="openrouter/apodex/apodex-1.1-mini:free,openrouter/cohere/north-mini-code:free,openrouter/google/gemma-4-26b-a4b-it:free,openrouter/google/gemma-4-31b-it:free"
if [[ ${LAB_AI_STACK_OPENROUTER_MODELS+x} ]]; then
OMNIROUTE_OPENROUTER_MODELS="${LAB_AI_STACK_OPENROUTER_MODELS}"
OMNIROUTE_OPENROUTER_MODELS_EXACT="true"
else
OMNIROUTE_OPENROUTER_MODELS="${DEFAULT_OPENROUTER_MODELS}"
OMNIROUTE_OPENROUTER_MODELS_EXACT="false"
fi
if [[ ${LAB_AI_STACK_NVIDIA_MODELS+x} ]]; then
OMNIROUTE_NVIDIA_MODELS="${LAB_AI_STACK_NVIDIA_MODELS}"
@ -259,6 +261,7 @@ discover_model_routes() {
OPENROUTER_URL="${OPENROUTER_URL}" \
NVIDIA_URL="${NVIDIA_URL}" \
OPENROUTER_MODELS="${OMNIROUTE_OPENROUTER_MODELS}" \
OPENROUTER_MODELS_EXACT="${OMNIROUTE_OPENROUTER_MODELS_EXACT}" \
NVIDIA_MODELS="${OMNIROUTE_NVIDIA_MODELS}" \
ENABLE_NVIDIA_DISCOVERY="${OMNIROUTE_ENABLE_NVIDIA_DISCOVERY}" \
python3 - "${output_json}" <<'PY'
@ -274,6 +277,7 @@ nvidia_key = os.environ.get("NVIDIA_KEY", "")
openrouter_url = os.environ["OPENROUTER_URL"].rstrip("/")
nvidia_url = os.environ["NVIDIA_URL"].rstrip("/")
preferred_openrouter = os.environ.get("OPENROUTER_MODELS", "")
openrouter_models_exact = os.environ.get("OPENROUTER_MODELS_EXACT", "").lower() in ("1", "true", "yes", "on")
preferred_nvidia = os.environ.get("NVIDIA_MODELS", "")
enable_nvidia_discovery = os.environ.get("ENABLE_NVIDIA_DISCOVERY", "").lower() in ("1", "true", "yes", "on")
@ -332,7 +336,7 @@ def priority(model):
openrouter_models = []
openrouter_discovered = []
if openrouter_key:
if openrouter_key and not openrouter_models_exact:
for item in fetch_json(f"{openrouter_url}/models", openrouter_key).get("data", []) or []:
model_id = item.get("id")
if not isinstance(model_id, str) or not model_id: