Spaces:
Running
Running
Upload models_dev_stub.py with huggingface_hub
Browse files- models_dev_stub.py +65 -0
models_dev_stub.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub: only curated models from config."""
|
| 2 |
+
import logging, json
|
| 3 |
+
from dataclasses import dataclass
|
| 4 |
+
from typing import Any, Dict, List, Optional, Tuple
|
| 5 |
+
|
| 6 |
+
logger = logging.getLogger(__name__)
|
| 7 |
+
|
| 8 |
+
@dataclass
|
| 9 |
+
class ProviderInfo:
|
| 10 |
+
name: str = ""
|
| 11 |
+
base_url: str = ""
|
| 12 |
+
api_doc: str = ""
|
| 13 |
+
env_vars: Tuple[str, ...] = ()
|
| 14 |
+
extra_env_vars: Tuple[str, ...] = ()
|
| 15 |
+
is_aggregator: bool = False
|
| 16 |
+
|
| 17 |
+
CURATED_MODELS = [
|
| 18 |
+
{"id": "meta-llama/llama-3.3-70b-instruct:free", "provider_id": "openrouter", "name": "Llama 3.3 70B Instruct"},
|
| 19 |
+
{"id": "deepseek/deepseek-v4-flash:free", "provider_id": "openrouter", "name": "Deepseek V4 Flash"},
|
| 20 |
+
{"id": "z-ai/glm-4.5-air:free", "provider_id": "openrouter", "name": "Glm 4.5 Air"},
|
| 21 |
+
{"id": "minimax/minimax-m2.5:free", "provider_id": "openrouter", "name": "Minimax M2.5"},
|
| 22 |
+
{"id": "google/gemma-4-31b-it:free", "provider_id": "openrouter", "name": "Gemma 4 31B It"},
|
| 23 |
+
{"id": "google/gemma-4-26b-a4b-it:free", "provider_id": "openrouter", "name": "Gemma 4 26B A4B It"},
|
| 24 |
+
{"id": "qwen/qwen3-coder:free", "provider_id": "openrouter", "name": "Qwen3 Coder"},
|
| 25 |
+
{"id": "qwen/qwen3-next-80b-a3b-instruct:free", "provider_id": "openrouter", "name": "Qwen3 Next 80B A3B Instruct"},
|
| 26 |
+
{"id": "nousresearch/hermes-3-llama-3.1-405b:free", "provider_id": "openrouter", "name": "Hermes 3 Llama 3.1 405B"},
|
| 27 |
+
{"id": "openai/gpt-oss-120b:free", "provider_id": "openrouter", "name": "Gpt Oss 120B"},
|
| 28 |
+
{"id": "openai/gpt-oss-20b:free", "provider_id": "openrouter", "name": "Gpt Oss 20B"},
|
| 29 |
+
{"id": "baidu/cobuddy:free", "provider_id": "openrouter", "name": "Cobuddy"},
|
| 30 |
+
{"id": "arcee-ai/trinity-large-thinking:free", "provider_id": "openrouter", "name": "Trinity Large Thinking"},
|
| 31 |
+
{"id": "liquid/lfm-2.5-1.2b-thinking:free", "provider_id": "openrouter", "name": "Lfm 2.5 1.2B Thinking"},
|
| 32 |
+
{"id": "liquid/lfm-2.5-1.2b-instruct:free", "provider_id": "openrouter", "name": "Lfm 2.5 1.2B Instruct"},
|
| 33 |
+
{"id": "meta-llama/llama-3.2-3b-instruct:free", "provider_id": "openrouter", "name": "Llama 3.2 3B Instruct"},
|
| 34 |
+
{"id": "cognitivecomputations/dolphin-mistral-24b-venice-edition:free", "provider_id": "openrouter", "name": "Dolphin Mistral 24B Venice Edition"},
|
| 35 |
+
{"id": "nvidia/nemotron-3-super-120b-a12b:free", "provider_id": "openrouter", "name": "Nemotron 3 Super 120B A12B"},
|
| 36 |
+
{"id": "nvidia/nemotron-3-nano-30b-a3b:free", "provider_id": "openrouter", "name": "Nemotron 3 Nano 30B A3B"},
|
| 37 |
+
{"id": "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free", "provider_id": "openrouter", "name": "Nemotron 3 Nano Omni 30B A3B Reasoning"},
|
| 38 |
+
{"id": "nvidia/nemotron-nano-9b-v2:free", "provider_id": "openrouter", "name": "Nemotron Nano 9B V2"},
|
| 39 |
+
{"id": "nvidia/nemotron-nano-12b-v2-vl:free", "provider_id": "openrouter", "name": "Nemotron Nano 12B V2 Vl"},
|
| 40 |
+
{"id": "nvidia/llama-nemotron-embed-vl-1b-v2:free", "provider_id": "openrouter", "name": "Llama Nemotron Embed Vl 1B V2"},
|
| 41 |
+
{"id": "poolside/laguna-m.1:free", "provider_id": "openrouter", "name": "Laguna M.1"},
|
| 42 |
+
{"id": "poolside/laguna-xs.2:free", "provider_id": "openrouter", "name": "Laguna Xs.2"},
|
| 43 |
+
{"id": "openrouter/auto:free", "provider_id": "openrouter", "name": "Auto"},
|
| 44 |
+
]
|
| 45 |
+
|
| 46 |
+
def get_provider_info(provider_id: str) -> Optional[ProviderInfo]:
|
| 47 |
+
if provider_id == "openrouter":
|
| 48 |
+
return ProviderInfo(name="OpenRouter", base_url="https://openrouter.ai/api/v1", is_aggregator=True)
|
| 49 |
+
return None
|
| 50 |
+
|
| 51 |
+
def get_all_models() -> list:
|
| 52 |
+
return CURATED_MODELS
|
| 53 |
+
|
| 54 |
+
def search_models(query: str = "", provider: str = "") -> list:
|
| 55 |
+
if provider and provider != "openrouter": return []
|
| 56 |
+
if query: return [m for m in CURATED_MODELS if query.lower() in m["id"].lower()]
|
| 57 |
+
return CURATED_MODELS
|
| 58 |
+
|
| 59 |
+
def get_model(model_id: str) -> Optional[dict]:
|
| 60 |
+
for m in CURATED_MODELS:
|
| 61 |
+
if m["id"] == model_id: return m
|
| 62 |
+
return None
|
| 63 |
+
|
| 64 |
+
def get_providers() -> dict:
|
| 65 |
+
return {"openrouter": {"name": "OpenRouter", "base_url": "https://openrouter.ai/api/v1", "is_aggregator": True}}
|