Get Started with Google Gemini
Follow these simple steps to start building with Google Gemini's powerful AI capabilities.
1
Set Up Your Environment
Before you start using Google Gemini, you need to set up your development environment and get your API keys.
- Create a Google Cloud account if you don't have one
- Enable the Gemini API in your Google Cloud Console
- Generate an API key for authentication
2
Install the Google AI JavaScript SDK
The Google AI JavaScript SDK provides a simple way to interact with the Gemini API from your JavaScript or TypeScript applications.
npm install @google/generative-ai
This SDK supports both Node.js and browser environments, making it versatile for various application types.
3
Make Your First API Call
Now that you have set up your environment and installed the SDK, you can make your first API call to Gemini.
import { GoogleGenerativeAI } from '@google/generative-ai'; // Initialize the API with your API key const genAI = new GoogleGenerativeAI('YOUR_API_KEY'); // Create a model instance const model = genAI.getGenerativeModel({ model: 'gemini-pro' }); // Generate content async function generateContent() { const result = await model.generateContent('Write a hello world program in JavaScript'); console.log(result.response.text()); } generateContent();
Ready to Build?
Now that you've set up your environment and made your first API call, you're ready to start building with Google Gemini!