26 lines
744 B
Python
26 lines
744 B
Python
import os
|
|
import requests
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv(dotenv_path="/home/node/clawd/.env")
|
|
|
|
def test_prod_key():
|
|
key = os.getenv("GEMINI_API_KEY_PROD")
|
|
if not key:
|
|
print("❌ GEMINI_API_KEY_PROD not found in .env")
|
|
return
|
|
|
|
print(f"🔑 Testing Key: {key[:5]}...{key[-3:]}")
|
|
|
|
url = f"https://generativelanguage.googleapis.com/v1beta/models?key={key}"
|
|
resp = requests.get(url)
|
|
|
|
if resp.status_code == 200:
|
|
print("✅ API Call Successful! Key is active.")
|
|
# print(f"Available Models: {[m['name'] for m in resp.json().get('models', [])][:3]}")
|
|
else:
|
|
print(f"❌ API Error: {resp.status_code} - {resp.text}")
|
|
|
|
if __name__ == "__main__":
|
|
test_prod_key()
|