Gemini API quickstart

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


Prerequisites

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.

Install the SDK

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.

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.