Generative AI with Node.js in Hindi #14 Gemini setup with key in Node js
Gemini setup with key in Node js
Steps :-
- Login to aistudio.google.com
- Generate key
- Install @google/genai npm package
- Write and test code for basic answers
- Interview Question
- Code and Notes
import {GoogleGenAI} from '@google/genai'
import dotenv from 'dotenv'
dotenv.config();
const googleAI = new GoogleGenAI({apiKey:process.env.geminiKey})
async function main(){
const response = await googleAI.models.generateContent({
model:"gemini-2.5-flash",
contents:"tell me table of 39"
})
console.log(response.text)
}
main()