bep40 commited on
Commit
38a63c8
·
verified ·
1 Parent(s): a1b356d

Upload patch_models.py

Browse files
Files changed (1) hide show
  1. patch_models.py +8 -8
patch_models.py CHANGED
@@ -57,11 +57,12 @@ marker = """ if local_model_provider(normalized_model) is not None:
57
  replacement = """ if local_model_provider(normalized_model) is not None:
58
  return _resolve_local_model_params(normalized_model, reasoning_effort, strict)
59
 
60
- # === PATCH: Route "openai/..." models to OpenRouter ===
61
- # These are OpenRouter-specific models (Laguna, Nemotron free, Owl Alpha, etc.)
62
- # that aren't served by the HF Router. LiteLLM openai/ prefix + custom api_base
63
- # makes it send the bare model name to OpenRouter.
64
- if normalized_model.startswith("openai/"):
 
65
  return {
66
  "model": normalized_model,
67
  "api_base": "https://openrouter.ai/api/v1",
@@ -89,6 +90,5 @@ with open(LLM_PARAMS_FILE, "w") as f:
89
 
90
  print("✅ Backend patched successfully")
91
  print(" - AVAILABLE_MODELS: 12 new models")
92
- print(" - Owl Alpha id: openai/owl-alpha (matches frontend modelPath)")
93
- print(" - _resolve_llm_params: openai/ prefix OpenRouter routing")
94
- print(" - DEFAULT_FREE_MODEL_ID: deepseek-ai/DeepSeek-V4-Pro")
 
57
  replacement = """ if local_model_provider(normalized_model) is not None:
58
  return _resolve_local_model_params(normalized_model, reasoning_effort, strict)
59
 
60
+ # === PATCH: Route OpenRouter-only models to openrouter.ai ===
61
+ # Models with openai/<org>/<model> (3+ segments) are OpenRouter-only
62
+ # and must NOT go through HF Router, which doesn't serve them.
63
+ # openai/gpt-5.5:fal-ai (1 segment) stays on HF Router as before.
64
+ _or_prefixes = ("openai/google/", "openai/deepseek/", "openai/nvidia/", "openai/poolside/")
65
+ if normalized_model.startswith(_or_prefixes) or normalized_model == "openai/owl-alpha":
66
  return {
67
  "model": normalized_model,
68
  "api_base": "https://openrouter.ai/api/v1",
 
90
 
91
  print("✅ Backend patched successfully")
92
  print(" - AVAILABLE_MODELS: 12 new models")
93
+ print(" - _resolve_llm_params: openai/google/|deepseek/|nvidia/|poolside/ + owl-alpha OpenRouter")
94
+ print(" - openai/gpt-5.5:fal-ai stays on HF Router (correct)")