Refactor GTM Architect to v2: Python-driven architecture, 9-phase process, new DB and Docker setup
This commit is contained in:
36
check_models.py
Normal file
36
check_models.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import requests
|
||||
import os
|
||||
|
||||
def load_gemini_api_key(file_path="gemini_api_key.txt"):
|
||||
try:
|
||||
with open(file_path, "r") as f:
|
||||
api_key = f.read().strip()
|
||||
return api_key
|
||||
except Exception as e:
|
||||
print(f"Fehler beim Laden des Gemini API Keys: {e}")
|
||||
return None
|
||||
|
||||
def check_models():
|
||||
api_key = load_gemini_api_key()
|
||||
if not api_key:
|
||||
return
|
||||
|
||||
url = f"https://generativelanguage.googleapis.com/v1beta/models?key={api_key}"
|
||||
|
||||
try:
|
||||
response = requests.get(url)
|
||||
print(f"Status Code: {response.status_code}")
|
||||
if response.status_code == 200:
|
||||
models = response.json().get('models', [])
|
||||
print("Verfügbare Modelle:")
|
||||
for m in models:
|
||||
if 'generateContent' in m.get('supportedGenerationMethods', []):
|
||||
print(f"- {m['name']}")
|
||||
else:
|
||||
print("Fehler beim Abrufen der Modelle:")
|
||||
print(response.text)
|
||||
except Exception as e:
|
||||
print(f"Request failed: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
check_models()
|
||||
Reference in New Issue
Block a user