import os import google.generativeai as genai from dotenv import load_dotenv load_dotenv() api_key = os.getenv("GEMINI_API_KEY") if not api_key: api_key = os.getenv("GEMINI_API_KEY_1") if not api_key: api_key = os.getenv("GEMINI_API_KEY_2") if not api_key: print("Error: GEMINI_API_KEY (or variants) not found in environment.") else: # Use the google.genai client similar to app.py # But for listing models, the google.generativeai module is often easier/standard # Let's try to stick to what works for listing. genai.configure(api_key=api_key) print(f"Checking models for key ending in ...{api_key[-4:]}") try: print("\nAvailable Models:") for m in genai.list_models(): if 'generateContent' in m.supported_generation_methods: print(f"- {m.name}") except Exception as e: print(f"Error listing models: {e}")