File size: 736 Bytes
a78209f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import google.generativeai as genai
import os
from dotenv import load_dotenv

# Load env vars
load_dotenv()
api_key = os.getenv("GEMINI_API_KEY")

if not api_key:
    print("Error: GEMINI_API_KEY not found in .env")
    exit(1)

genai.configure(api_key=api_key)

print(f"Checking models for API Key: {api_key[:5]}...{api_key[-4:]}")

try:
    print("\n--- Available Generative Models ---")
    found_any = False
    for m in genai.list_models():
        if 'generateContent' in m.supported_generation_methods:
            print(f"- {m.name}")
            found_any = True
    
    if not found_any:
        print("No models found that support 'generateContent'.")
        
except Exception as e:
    print(f"Error listing models: {e}")