-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_models.py
More file actions
32 lines (26 loc) · 979 Bytes
/
list_models.py
File metadata and controls
32 lines (26 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import requests
import json
API_KEY = "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"
try:
response = requests.get(
"https://openrouter.ai/api/v1/models",
headers={
"Authorization": f"Bearer {API_KEY}",
"HTTP-Referer": "http://localhost:5173",
"X-Title": "MultiModalDocIntel"
}
)
if response.status_code == 200:
d = response.json()
print("Success! Found models:")
# Filter for free ones
free_models = [m['id'] for m in d['data'] if ':free' in m['id']]
print(json.dumps(free_models, indent=2))
# Also print first 5 regular models to verify access
print("\nTop 5 non-free models:")
print(json.dumps([m['id'] for m in d['data'][:5]], indent=2))
else:
print(f"Failed: {response.status_code} - {response.text}")
except Exception as e:
print(e)