H3y-sam commited on
Commit
b07da3d
·
verified ·
1 Parent(s): 5450fae

Upload 58 files

Browse files
Files changed (1) hide show
  1. test_models.py +17 -0
test_models.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import httpx
2
+ import asyncio
3
+
4
+ async def fetch_models():
5
+ url = 'https://openrouter.ai/api/v1/models'
6
+ async with httpx.AsyncClient() as client:
7
+ resp = await client.get(url)
8
+ if resp.status_code == 200:
9
+ data = resp.json()
10
+ free_models = [m['id'] for m in data['data'] if 'free' in m['id']]
11
+ print('Free Models:')
12
+ for m in free_models:
13
+ print(m)
14
+ else:
15
+ print('Failed to fetch')
16
+
17
+ asyncio.run(fetch_models())