main
Some checks failed
Backend Deploy 🚀 / build-and-deploy (push) Has been cancelled

This commit is contained in:
Harun CAN
2026-04-05 21:11:00 +03:00
parent 9486f86cca
commit 6627c213ec
6 changed files with 63 additions and 13 deletions

26
test-gemini-image.ts Normal file
View File

@@ -0,0 +1,26 @@
import { GoogleGenAI } from '@google/genai';
import * as dotenv from 'dotenv';
dotenv.config();
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
async function listModels() {
console.log('Listing models...');
try {
let hasImagen = false;
let hasPreview = false;
// Iterate over pagination using valid SDK method if possible, but let's just use REST if not found.
// However, the new `@google/genai` has ai.models.list()
const response = await ai.models.list();
for await (const m of response) {
if (m.name.includes('image') || m.name.includes('imagen')) {
console.log(m.name);
}
}
} catch (error) {
console.error('Error listing models:', error);
}
}
listModels();