BaseChat / list_models.py
yuchenlin's picture
side by side
d8f6559
raw
history blame
541 Bytes
import requests
import json
import os
url = "https://api.together.xyz/v1/models"
headers = {
"accept": "application/json",
"Authorization": f"Bearer {os.getenv('TOGETHER_API_KEY')}"
}
response = requests.get(url, headers=headers)
data = response.json()
keywords = ["OLMO"]
model_ids = []
for item in data:
if any(keyword.lower() in item["id"].lower() for keyword in keywords):
print(item["id"])
model_ids.append(item["id"])
with open("together_model_ids.json", "w") as f:
json.dump(model_ids, f, indent=4)