import { GoogleGenerativeAI } from '@google/generative-ai';
import dotenv from 'dotenv';
dotenv.config();
async function listModels() {
    const apiKey = process.env.GEMINI_API_KEY;
    if (!apiKey) {
        console.error('No API key found in .env');
        return;
    }
    const genAI = new GoogleGenerativeAI(apiKey);
    try {
        const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" }); // Dummy init just to get client? 
        // Actually SDK doesn't have listModels on instance usually, wait. 
        // Looking at docs, typically: 
        // But I can try to just use valid model or see error. 
        // Actually the error message suggested calling ListModels.
        // The node SDK might have it on the class or manager.
        // Let's rely on standard fetch if SDK usage is ambiguous in my memory, but wait/
        // genAI seems to match the code in ai.ts. 
        // Let's try to just run a simple test with "gemini-2.0-flash-exp"
        console.log("Testing gemini-2.0-flash-exp...");
        const model2 = genAI.getGenerativeModel({ model: "gemini-2.0-flash-exp" });
        const result = await model2.generateContent("Hello");
        console.log("gemini-2.0-flash-exp works!", result.response.text());
    }
    catch (e) {
        console.log("gemini-2.0-flash-exp failed:", e.message);
        try {
            console.log("Testing gemini-1.5-pro...");
            const model3 = genAI.getGenerativeModel({ model: "gemini-1.5-pro" });
            const result3 = await model3.generateContent("Hello");
            console.log("gemini-1.5-pro works!");
        }
        catch (e2) {
            console.log("gemini-1.5-pro failed:", e2.message);
        }
    }
}
listModels();
//# sourceMappingURL=test_models.js.map