This quickstart shows you how to get started with the Gemini API using the SDK of your choice.
Prerequisites
Install the Google AI SDK
Set up authentication
The easiest way to authenticate to the Gemini API is to configure an API key, as described in this section. If you need stricter access controls, you can use OAuth instead.
If you don't already have an API key, create one in Google AI Studio.
Get an API key from Google AI Studio
Then, configure your key.
Import the library
Make your first request
Use the
generateContent
method
to generate text.
What's next
Now that you're set up to make requests to the Gemini API, you can use the full range of Gemini API capabilities to build your apps and workflows. To get started with Gemini API capabilities, see the following guides:
For in-depth documentation of Gemini API methods and request parameters, see the guides in the API reference.