Spaces:
Running
Running
File size: 506 Bytes
b07da3d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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())
|