mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-16 17:55:26 -04:00
Models: add Z.AI coding endpoint and GLM vision detection
This commit is contained in:
+18
-3
@@ -89,10 +89,13 @@ _PROVIDER_CURATED = {
|
|||||||
"claude-sonnet-4-5", "claude-haiku-3-5",
|
"claude-sonnet-4-5", "claude-haiku-3-5",
|
||||||
],
|
],
|
||||||
"zai": [
|
"zai": [
|
||||||
"glm-5", "glm-4.7", "glm-4.7-flash",
|
"glm-5", "glm-5.1", "glm-5v-turbo", "glm-4.7", "glm-4.7-flash",
|
||||||
"glm-4.6", "glm-4.6v",
|
"glm-4.6", "glm-4.6v",
|
||||||
"glm-4.5", "glm-4.5v", "glm-4.5-air", "glm-4.5-flash",
|
"glm-4.5", "glm-4.5v", "glm-4.5-air", "glm-4.5-flash",
|
||||||
],
|
],
|
||||||
|
"zai-coding": [
|
||||||
|
"glm-5.1", "glm-5v-turbo", "glm-5-turbo", "glm-4.7", "glm-4.5-air",
|
||||||
|
],
|
||||||
"deepseek": [
|
"deepseek": [
|
||||||
"deepseek-chat", "deepseek-reasoner",
|
"deepseek-chat", "deepseek-reasoner",
|
||||||
],
|
],
|
||||||
@@ -151,9 +154,14 @@ _HOST_TO_CURATED = (
|
|||||||
def _match_provider_curated(base_url: str, provider: str) -> str:
|
def _match_provider_curated(base_url: str, provider: str) -> str:
|
||||||
"""Return the curated-list key for a given endpoint.
|
"""Return the curated-list key for a given endpoint.
|
||||||
|
|
||||||
Matches the base URL's hostname against known providers; falls back to
|
Checks path-based overrides first (for hosts serving multiple plans),
|
||||||
the raw provider string from _detect_provider().
|
then matches the base URL's hostname against known providers, and
|
||||||
|
finally falls back to the raw provider string from _detect_provider().
|
||||||
"""
|
"""
|
||||||
|
# Path-based overrides for hosts that serve multiple curated lists.
|
||||||
|
parsed = urlparse(base_url)
|
||||||
|
if _host_match(base_url, "z.ai") and "/api/coding" in (parsed.path or ""):
|
||||||
|
return "zai-coding"
|
||||||
for domain, key in _HOST_TO_CURATED:
|
for domain, key in _HOST_TO_CURATED:
|
||||||
if _host_match(base_url, domain):
|
if _host_match(base_url, domain):
|
||||||
return key
|
return key
|
||||||
@@ -356,6 +364,13 @@ def _probe_endpoint(base_url: str, api_key: str = None, timeout: int = 5) -> Lis
|
|||||||
if not models:
|
if not models:
|
||||||
models = [m.get("name") or m.get("model") for m in (data.get("models") or []) if m.get("name") or m.get("model")]
|
models = [m.get("name") or m.get("model") for m in (data.get("models") or []) if m.get("name") or m.get("model")]
|
||||||
if models:
|
if models:
|
||||||
|
# Z.AI coding plan omits some working models from /models;
|
||||||
|
# append curated-only entries for that endpoint only.
|
||||||
|
if _host_match(base, "z.ai") and "/api/coding" in (urlparse(base).path or ""):
|
||||||
|
_ck = _match_provider_curated(base, None)
|
||||||
|
for _e in _PROVIDER_CURATED.get(_ck, []):
|
||||||
|
if _e not in set(models) and not any(m.startswith(_e) for m in models):
|
||||||
|
models.append(_e)
|
||||||
return models
|
return models
|
||||||
except httpx.HTTPStatusError as e:
|
except httpx.HTTPStatusError as e:
|
||||||
if api_key:
|
if api_key:
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ _VISION_MODEL_KEYWORDS = (
|
|||||||
# open / local
|
# open / local
|
||||||
"vision", "llava", "bakllava", "moondream", "pixtral", "minicpm",
|
"vision", "llava", "bakllava", "moondream", "pixtral", "minicpm",
|
||||||
"internvl", "cogvlm", "qwen-vl", "qwen2-vl", "qwen3-vl", "qwen3vl",
|
"internvl", "cogvlm", "qwen-vl", "qwen2-vl", "qwen3-vl", "qwen3vl",
|
||||||
|
# zhipu / glm (glm-4.5v, glm-4.6v, glm-5v-turbo, etc.)
|
||||||
|
"glm-4.5v", "glm-4.6v", "glm-5v",
|
||||||
)
|
)
|
||||||
# Catches the "*-VL-*" / "*VL*" family not covered by a literal keyword above
|
# Catches the "*-VL-*" / "*VL*" family not covered by a literal keyword above
|
||||||
# (e.g. Qwen2.5-VL and various tags): a standalone "vl" token, plus "vlm".
|
# (e.g. Qwen2.5-VL and various tags): a standalone "vl" token, plus "vlm".
|
||||||
|
|||||||
@@ -2075,6 +2075,7 @@
|
|||||||
<option value="https://generativelanguage.googleapis.com/v1beta/openai" data-logo="gemini">Google Gemini</option>
|
<option value="https://generativelanguage.googleapis.com/v1beta/openai" data-logo="gemini">Google Gemini</option>
|
||||||
<option value="https://api.x.ai/v1" data-logo="grok">xAI Grok</option>
|
<option value="https://api.x.ai/v1" data-logo="grok">xAI Grok</option>
|
||||||
<option value="https://api.z.ai/api/paas/v4" data-logo="zhipu">Z.AI (Zhipu)</option>
|
<option value="https://api.z.ai/api/paas/v4" data-logo="zhipu">Z.AI (Zhipu)</option>
|
||||||
|
<option value="https://api.z.ai/api/coding/paas/v4" data-logo="zhipu">Z.AI Coding Plan</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="admin-model-form-row">
|
<div class="admin-model-form-row">
|
||||||
<input id="adm-epApiKey" type="password" placeholder="API key">
|
<input id="adm-epApiKey" type="password" placeholder="API key">
|
||||||
|
|||||||
Reference in New Issue
Block a user