Upload patch_models.py

#10
by bep40 - opened
Files changed (1) hide show
  1. patch_models.py +12 -3
patch_models.py CHANGED
@@ -26,7 +26,7 @@ content = content.replace(
26
  )
27
  content = content.replace(
28
  'GLM_52_MODEL_ID = "zai-org/GLM-5.2:novita"',
29
- 'GLM_52_MODEL_ID = "deepseek/deepseek-v4-flash"',
30
  )
31
  content = content.replace(
32
  'DEEPSEEK_V4_PRO_MODEL_ID = "deepseek-ai/DeepSeek-V4-Pro:novita"',
@@ -43,7 +43,8 @@ LAGUNA_M1_FREE_MODEL_ID = "openai/poolside/laguna-m.1:free"
43
  LAGUNA_S21_FREE_MODEL_ID = "openai/poolside/laguna-s-2.1:free"
44
  NEX_N2_MINI_MODEL_ID = "openai/nex-agi/nex-n2-mini"
45
  LING_3_0_FLASH_FREE_MODEL_ID = "openai/inclusionai/ling-3.0-flash:free"
46
- DEEPSEEK_V4_FLASH_LATEST_MODEL_ID = "deepseek/deepseek-v4-flash-latest"
 
47
  """
48
  if "GEMMA_4_31B_FREE_MODEL_ID" not in content:
49
  content = content.replace(
@@ -104,6 +105,7 @@ new_import = (
104
  " NEX_N2_MINI_MODEL_ID,\n"
105
  " LING_3_0_FLASH_FREE_MODEL_ID,\n"
106
  " DEEPSEEK_V4_FLASH_LATEST_MODEL_ID,\n"
 
107
  " strip_huggingface_model_prefix,\n"
108
  ")"
109
  )
@@ -125,7 +127,7 @@ new_func = (
125
  ' {"id": MINIMAX_M3_MODEL_ID, "label": "DeepSeek V4 Flash"},\n'
126
  ' {"id": DEFAULT_MODEL_ID, "label": "DeepSeek V4 Flash"},\n'
127
  ' {"id": DEEPSEEK_V4_PRO_MODEL_ID, "label": "Nemotron 3 Super 120B"},\n'
128
- ' {"id": DEEPSEEK_V4_FLASH_LATEST_MODEL_ID, "label": "DeepSeek V4 Flash latest (no tools)"},\n'
129
  " ]\n"
130
  " return models"
131
  )
@@ -190,6 +192,13 @@ if "normalized_model.startswith" not in llm_content:
190
  if api_key_find in llm_content:
191
  line_end = llm_content.find("\n", llm_content.find(api_key_find) + len(api_key_find)) + 1
192
  routing_insert = (
 
 
 
 
 
 
 
193
  ' # Route openai/-prefixed models to OpenRouter\n'
194
  ' if normalized_model.startswith("openai/"):\n'
195
  ' return {\n'
 
26
  )
27
  content = content.replace(
28
  'GLM_52_MODEL_ID = "zai-org/GLM-5.2:novita"',
29
+ 'GLM_52_MODEL_ID = "openai/deepseek/deepseek-v4-flash"',
30
  )
31
  content = content.replace(
32
  'DEEPSEEK_V4_PRO_MODEL_ID = "deepseek-ai/DeepSeek-V4-Pro:novita"',
 
43
  LAGUNA_S21_FREE_MODEL_ID = "openai/poolside/laguna-s-2.1:free"
44
  NEX_N2_MINI_MODEL_ID = "openai/nex-agi/nex-n2-mini"
45
  LING_3_0_FLASH_FREE_MODEL_ID = "openai/inclusionai/ling-3.0-flash:free"
46
+ DEEPSEEK_V4_FLASH_LATEST_MODEL_ID = "~deepseek/deepseek-v4-flash-latest"
47
+ NO_TOOLS_MODELS = {"~deepseek/deepseek-v4-flash-latest", "deepseek/deepseek-v4-flash"}
48
  """
49
  if "GEMMA_4_31B_FREE_MODEL_ID" not in content:
50
  content = content.replace(
 
105
  " NEX_N2_MINI_MODEL_ID,\n"
106
  " LING_3_0_FLASH_FREE_MODEL_ID,\n"
107
  " DEEPSEEK_V4_FLASH_LATEST_MODEL_ID,\n"
108
+ " NO_TOOLS_MODELS,\n"
109
  " strip_huggingface_model_prefix,\n"
110
  ")"
111
  )
 
127
  ' {"id": MINIMAX_M3_MODEL_ID, "label": "DeepSeek V4 Flash"},\n'
128
  ' {"id": DEFAULT_MODEL_ID, "label": "DeepSeek V4 Flash"},\n'
129
  ' {"id": DEEPSEEK_V4_PRO_MODEL_ID, "label": "Nemotron 3 Super 120B"},\n'
130
+ ' {"id": DEEPSEEK_V4_FLASH_LATEST_MODEL_ID, "label": "DeepSeek V4 Flash latest"},\n'
131
  " ]\n"
132
  " return models"
133
  )
 
192
  if api_key_find in llm_content:
193
  line_end = llm_content.find("\n", llm_content.find(api_key_find) + len(api_key_find)) + 1
194
  routing_insert = (
195
+ ' # Route deepseek/-prefixed models to OpenRouter (no tool use)\n'
196
+ ' if normalized_model.startswith("~deepseek/") or normalized_model.startswith("deepseek/"):\n'
197
+ ' return {\n'
198
+ ' "model": normalized_model,\n'
199
+ ' "api_base": "https://openrouter.ai/api/v1",\n'
200
+ ' "api_key": os.environ.get("OPENROUTER_API_KEY") or api_key or "",\n'
201
+ ' }\n\n'
202
  ' # Route openai/-prefixed models to OpenRouter\n'
203
  ' if normalized_model.startswith("openai/"):\n'
204
  ' return {\n'