-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist-models.js
More file actions
26 lines (24 loc) · 774 Bytes
/
Copy pathlist-models.js
File metadata and controls
26 lines (24 loc) · 774 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
require('dotenv').config();
const axios = require('axios');
const API_KEY = process.env.GEMINI_API_KEY;
async function run() {
try {
if (!API_KEY) {
throw new Error('Missing GEMINI_API_KEY in environment');
}
const versions = ['v1', 'v1beta'];
for (const version of versions) {
try {
const res = await axios.get(`https://generativelanguage.googleapis.com/${version}/models?key=${API_KEY}`);
const names = (res.data.models || []).map(m => m.name);
console.log(`\n${version} models:`);
console.log(names);
} catch (err) {
console.error(`${version} list failed:`, err.response?.data || err.message);
}
}
} catch (err) {
console.error(err.response?.data || err.message);
}
}
run();