Gemini API quickstart

This quickstart shows you how to get started with the Gemini API using the SDK of your choice.


Install the Gemini API SDK


Set up your API key

To use the Gemini API, you'll need an API key. If you don't already have one, create a key in Google AI Studio.

Get an API key

Then, configure your key.

Initialize the model

Before you can make any API calls, you need to import and initialize the model. Gemini 1.5 models are versatile and work with both text-only and multimodal prompts.

Make your first request

Generate text

What's next

To learn more about working with the Gemini API, see the getting started tutorial for your language of choice. You can also read through the various guides and learn about the capabilities we offer in the Gemini API.