Spaces:
Paused
Paused
Download list-models.js from Luca448/APP-Backend: direct link, hf CLI and curl.
- Browser
- Download file 477 Bytes
-
https://huggingface.co/spaces/Luca448/APP-Backend/resolve/main/list-models.js
- Command line
-
hf download hf://spaces/Luca448/APP-Backend/list-models.js
-
curl -L -o list-models.js https://huggingface.co/spaces/Luca448/APP-Backend/resolve/main/list-models.js
477 Bytes
| import { db } from './src/db/database.js'; | |
| async function listModels() { | |
| const apiKey = db.getSetting('gemini_api_key'); | |
| if (!apiKey) return console.log("No API key"); | |
| const url = `https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey}`; | |
| const res = await fetch(url); | |
| const data = await res.json(); | |
| const names = data.models ? data.models.map(m => m.name) : data; | |
| console.log("Available models:", JSON.stringify(names, null, 2)); | |
| } | |
| listModels(); | |