20 lines
469 B
JavaScript
20 lines
469 B
JavaScript
require('dotenv').config();
|
|
const { GoogleGenAI } = require('@google/genai');
|
|
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
|
|
ai.models.generateContent({
|
|
model: 'gemini-3.6-flash',
|
|
contents: [
|
|
'Hello',
|
|
{
|
|
inlineData: {
|
|
data: Buffer.from('hello').toString("base64"),
|
|
mimeType: 'text/plain'
|
|
}
|
|
}
|
|
],
|
|
}).then(res => {
|
|
console.log('Success:', res.text);
|
|
}).catch(err => {
|
|
console.error('Error:', err);
|
|
});
|