Spaces:
Running
Running
Download test_models.py from H3y-sam/Telegram-Bot: direct link, hf CLI and curl.
- Browser
- Download file 506 Bytes
-
https://huggingface.co/spaces/H3y-sam/Telegram-Bot/resolve/main/test_models.py
- Command line
-
hf download hf://spaces/H3y-sam/Telegram-Bot/test_models.py
-
curl -L -o test_models.py https://huggingface.co/spaces/H3y-sam/Telegram-Bot/resolve/main/test_models.py
506 Bytes
| import httpx | |
| import asyncio | |
| async def fetch_models(): | |
| url = 'https://openrouter.ai/api/v1/models' | |
| async with httpx.AsyncClient() as client: | |
| resp = await client.get(url) | |
| if resp.status_code == 200: | |
| data = resp.json() | |
| free_models = [m['id'] for m in data['data'] if 'free' in m['id']] | |
| print('Free Models:') | |
| for m in free_models: | |
| print(m) | |
| else: | |
| print('Failed to fetch') | |
| asyncio.run(fetch_models()) | |