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 generative model

Generate text

What's next

To learn more about working with the Gemini API, see the tutorial for your language of choice.

You can also use curl commands to try out the Gemini API:

If you're new to generative AI models, you might want to look at the concepts guide and the Gemini API overview before trying a quickstart.