Download _list_models.py from Viske/Spjimr: direct link, hf CLI and curl.
- Browser
- Download file 351 Bytes
-
https://huggingface.co/spaces/Viske/Spjimr/resolve/main/_list_models.py
- Command line
-
hf download hf://spaces/Viske/Spjimr/_list_models.py
-
curl -L -o _list_models.py https://huggingface.co/spaces/Viske/Spjimr/resolve/main/_list_models.py
351 Bytes
| import os, requests | |
| data = requests.get( | |
| "https://router.huggingface.co/v1/models", | |
| headers={"Authorization": "Bearer " + os.getenv("HF_TOKEN")} | |
| ).json() | |
| for m in data.get("data", []): | |
| providers = m.get("providers", []) | |
| has_tools = any(p.get("supports_tools") for p in providers) | |
| if has_tools: | |
| print(m["id"]) | |