Spaces:
Sleeping
Sleeping
#!/usr/bin/env python3 | |
"""List available Gemini models""" | |
import os | |
import google.generativeai as genai | |
from dotenv import load_dotenv | |
load_dotenv() | |
try: | |
# Настройка API ключа | |
api_key = os.environ.get("GEMINI_API_KEY") | |
if not api_key: | |
print("GEMINI_API_KEY not found in environment variables") | |
exit(1) | |
genai.configure(api_key=api_key) | |
# Получение списка моделей | |
models = list(genai.list_models()) | |
print(f"Found {len(models)} models:") | |
for model in models: | |
print(f"\nModel name: {model.name}") | |
print(f"Display name: {model.display_name}") | |
print(f"Description: {model.description}") | |
print(f"Generation methods: {', '.join(model.supported_generation_methods) if hasattr(model, 'supported_generation_methods') else 'Not specified'}") | |
print(f"Input token limit: {model.input_token_limit}") | |
print(f"Output token limit: {model.output_token_limit}") | |
print(f"Temperature: {model.temperature}") | |
print("=" * 80) | |
except Exception as e: | |
print(f"Error listing models: {e}") | |