import { GoogleGenAI } from '@google/genai'; import * as dotenv from 'dotenv'; dotenv.config(); const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY }); async function listModels() { console.log('Listing models...'); try { let hasImagen = false; let hasPreview = false; // Iterate over pagination using valid SDK method if possible, but let's just use REST if not found. // However, the new `@google/genai` has ai.models.list() const response = await ai.models.list(); for await (const m of response) { if (m.name.includes('image') || m.name.includes('imagen')) { console.log(m.name); } } } catch (error) { console.error('Error listing models:', error); } } listModels();