-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_models.py
More file actions
31 lines (26 loc) · 939 Bytes
/
Copy pathtest_models.py
File metadata and controls
31 lines (26 loc) · 939 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
#!/usr/bin/env python3
"""Test script to verify API keys and models work."""
import sys
sys.path.insert(0, '/app')
from app.api_keys import APIKeyManager
from app.database import SessionLocal
from google import genai
from google.genai import types
db = SessionLocal()
mgr = APIKeyManager(db)
keys = mgr.get_active_keys()
print(f"Found {len(keys)} active keys")
for k in keys:
print(f"\n=== Key: {k.name} ===")
client = genai.Client(api_key=k.key)
for model in ["gemini-3-flash-preview", "gemini-2.0-flash"]:
try:
response = client.models.generate_content(
model=model,
contents="Say hi",
config=types.GenerateContentConfig(max_output_tokens=10),
)
print(f" {model}: OK - {response.text[:30] if response.text else 'empty'}")
except Exception as e:
err = str(e)[:150]
print(f" {model}: {err}")