| import os |
| from google import genai |
|
|
| def list_my_models(): |
| api_key = os.getenv("GEMINI_API_KEY") |
| if not api_key: |
| print("ERROR: GEMINI_API_KEY is not set in environment secrets.") |
| return |
|
|
| client = genai.Client(api_key=api_key) |
| print("--- Available Models for your API Key ---") |
| try: |
| for m in client.models.list(): |
| if "generateContent" in m.supported_actions: |
| print(f"ID: {m.name} | Display: {m.display_name}") |
| except Exception as e: |
| print(f"Failed to list models: {e}") |
|
|
| if __name__ == "__main__": |
| list_my_models() |