| | |
| | | ability: Optional[str] = Query(None), |
| | | verified_only: bool = False, |
| | | ): |
| | | from config import Config |
| | | response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" |
| | | if model_type: |
| | | base_models = get_models_by_type(model_type) |
| | | |
| | | # Inject models from config.yaml that might not be in hardcoded list |
| | | config_models = Config.as_dict().get("models", {}) |
| | | type_to_keys = { |
| | | "llm": ["llm"], |
| | | "vlm": ["vlm"], |
| | | "t2i": ["image_t2i"], |
| | | "i2i": ["image_it2i"], |
| | | "video": ["video", "video_first_frame", "video_start_end", "video_reference"] |
| | | } |
| | | existing_ids = {m["id"] for m in base_models} |
| | | for key in type_to_keys.get(model_type, []): |
| | | cfg_id = config_models.get(key) |
| | | if cfg_id and cfg_id not in existing_ids: |
| | | base_models.append({ |
| | | "id": cfg_id, |
| | | "name": cfg_id, |
| | | "provider": "custom", |
| | | "type": [model_type], |
| | | "concurrency": 3 |
| | | }) |
| | | existing_ids.add(cfg_id) |
| | | |
| | | models = [] |
| | | for model in get_models_by_type(model_type): |
| | | for model in base_models: |
| | | capabilities = model_type_capabilities(model_type, model) |
| | | models.append({ |
| | | "id": model["id"], |