-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist-models.js
More file actions
33 lines (26 loc) · 1.04 KB
/
Copy pathlist-models.js
File metadata and controls
33 lines (26 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const { GoogleGenerativeAI } = require("@google/generative-ai");
// ✅ Your Key is already here
const apiKey = "AIzaSyBuOFeGFCwLF5roKJegepRmaFj6jaE6YRc";
async function listModels() {
console.log("🔍 Authenticating with Google...");
try {
const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey}`);
const data = await response.json();
if (data.error) {
console.error("❌ API Error:", data.error.message);
// This usually means the API is OFF for this specific key/project
return;
}
console.log("\n✅ SUCCESS! Models available:");
console.log("---------------------------------------------------");
data.models.forEach(model => {
if (model.supportedGenerationMethods.includes("generateContent")) {
console.log(`👉 "${model.name.replace("models/", "")}"`);
}
});
console.log("---------------------------------------------------");
} catch (error) {
console.error("❌ Network Error:", error.message);
}
}
listModels();