Spaces:
Running
Running
| """Canonical model ids for HF Router inference.""" | |
| HF_ROUTER_BASE_URL = "https://router.huggingface.co/v1" | |
| # Keep these as verbatim HF Router ids; version punctuation differs by model. | |
| CLAUDE_OPUS_48_MODEL_ID = "anthropic/claude-opus-4.8:fal-ai" | |
| GPT_55_MODEL_ID = "openai/gpt-5.5:fal-ai" | |
| KIMI_K26_MODEL_ID = "moonshotai/Kimi-K2.6:novita" | |
| KIMI_K27_CODE_MODEL_ID = "moonshotai/Kimi-K2.7-Code" | |
| MINIMAX_M27_MODEL_ID = "MiniMaxAI/MiniMax-M2.7:novita" | |
| GLM_51_MODEL_ID = "zai-org/GLM-5.1:novita" | |
| DEEPSEEK_V4_PRO_MODEL_ID = "deepseek-ai/DeepSeek-V4-Pro:novita" | |
| HOSTED_MODEL_IDS = { | |
| CLAUDE_OPUS_48_MODEL_ID, | |
| GPT_55_MODEL_ID, | |
| KIMI_K26_MODEL_ID, | |
| KIMI_K27_CODE_MODEL_ID, | |
| MINIMAX_M27_MODEL_ID, | |
| GLM_51_MODEL_ID, | |
| DEEPSEEK_V4_PRO_MODEL_ID, | |
| } | |
| def strip_huggingface_model_prefix(model_id: str | None) -> str | None: | |
| """Return model ids without LiteLLM's optional ``huggingface/`` prefix.""" | |
| if not model_id: | |
| return model_id | |
| return model_id.removeprefix("huggingface/") | |
| def is_known_router_model_id(model_id: str | None) -> bool: | |
| normalized = strip_huggingface_model_prefix(model_id) | |
| return bool(normalized and normalized in HOSTED_MODEL_IDS) | |