-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-api.js
More file actions
26 lines (20 loc) · 753 Bytes
/
Copy pathtest-api.js
File metadata and controls
26 lines (20 loc) · 753 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();
// Notice the new import: @google/genai
const { GoogleGenAI } = require("@google/genai");
// Initialize the client
const client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
async function runTest() {
try {
// Gemini 3 Flash Preview is the fastest free model in Feb 2026
const modelId = "gemini-3-flash-preview";
console.log(`Connecting to ${modelId}...`);
const response = await client.models.generateContent({
model: modelId,
contents: [{ role: 'user', parts: [{ text: "Say 'The system is online' if you can hear me." }] }],
});
console.log("AI Response:", response.text);
} catch (error) {
console.error("Error details:", error.message);
}
}
runTest();