Spaces:
Sleeping
Sleeping
Download listModels.js from yonatanadvan/photomagnetAI: direct link, hf CLI and curl.
- Browser
- Download file 479 Bytes
-
https://huggingface.co/spaces/yonatanadvan/photomagnetAI/resolve/main/listModels.js
- Command line
-
hf download hf://spaces/yonatanadvan/photomagnetAI/listModels.js
-
curl -L -o listModels.js https://huggingface.co/spaces/yonatanadvan/photomagnetAI/resolve/main/listModels.js
479 Bytes
| import { GoogleGenAI } from "@google/genai"; | |
| async function listModels() { | |
| const ai = new GoogleGenAI({ apiKey: process.env.API_KEY }); | |
| const res = await ai.models.listModels(); // or ai.models.list() | |
| console.log("Available models:"); | |
| for (const m of res.models || res) { | |
| console.log( | |
| m.name, | |
| "| supports:", m.supportedGenerationMethods?.join(", ") || "none" | |
| ); | |
| } | |
| } | |
| listModels().catch(err => { | |
| console.error("Error listing models:", err); | |
| }); | |