File size: 702 Bytes
cf49347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import google.generativeai as genai
import os
from dotenv import load_dotenv

# 1. Load your API key
load_dotenv()
api_key = os.getenv("GEMINI_API_KEY")

if not api_key:
    print("Error: API key not found. Make sure it is in your .env file.")
else:
    genai.configure(api_key=api_key)

    print("--- Available Gemini Models ---")
    # 2. List all models and filter for those that generate content (text/chat)
    for m in genai.list_models():
        if 'generateContent' in m.supported_generation_methods:
            print(f"Name: {m.name}")
            print(f"   - Display Name: {m.display_name}")
            print(f"   - Input Limit: {m.input_token_limit} tokens")
            print("-" * 30)