-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_models.js
More file actions
27 lines (22 loc) · 746 Bytes
/
Copy pathlist_models.js
File metadata and controls
27 lines (22 loc) · 746 Bytes
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
import fetch from 'node-fetch';
const KEY = "AIzaSyB0PUOXKJnFy31aY7U_nmMv9UAcIvllr2s";
const URL = `https://generativelanguage.googleapis.com/v1beta/models?key=${KEY}`;
async function listModels() {
try {
const res = await fetch(URL);
const data = await res.json();
if (data.models) {
console.log("Available Models:");
data.models.forEach(m => {
if (m.name.includes('gemini')) {
console.log(m.name); // e.g. models/gemini-pro
}
});
} else {
console.log("Error/No models:", JSON.stringify(data, null, 2));
}
} catch (e) {
console.error("Fetch Error:", e);
}
}
listModels();