How to get your Gemini API key (5 steps)
Connecting Gemini—Google’s LLM and formerly known as Bard—with your internal applications and/or product can fundamentally change how your employees interact with your applications and/or how customers use your product.Â
But before you can access one of Gemini’s models via API requests, you’ll need to generate an API key within the Google AI Studio.Â
We’ll help you do just that by walking through each of the 5 steps you’ll need to take.
Step 1: Login to your Google account
You should see the sign in button on the top right corner of Google’s home page.
‍
‍
Step 2: Visit the “Google AI Studio”
You can find this landing page here. You'd then need to click on the “Gemini API” tab or click on the “Learn more about the Gemini API” button.
Alternatively, you can visit the Gemini API landing page directly.
‍
Related: How to get your API key from Llama
Step 3: Click on “Get API key in Google AI Studio”
This should appear as a button on the center of the page.
Step 4: Review and approve the terms of service
You should then see a pop-up that asks you to consent to Google APIs Terms of Service and Gemini API Additional Terms of Service.Â
While not required, you can also opt in to receive emails that keep you up to date on Google AI and ask you to participate in specific research studies for Google AI.
Go ahead and check off the first box (and the others if you’d like) and click Continue.
Step 5: Create your API key
You can now click “Create API key.”Â
You’ll then have the option to create an API key in a new project or via an existing project.
Once you’ve chosen one of these options, your API key should be auto-generated!
Remember to store this API key in a secure location to prevent unauthorized access.
Other considerations for building to Gemini’s API
Before building to Gemini’s API, you should also look into and understand the following areas:
Pricing plans
The pricing plans vary between Gemini 1.5 Flash, Gemini 1.5 Pro, and Gemini 1.0 Pro. However, they all come with a free tier and a pay-as-you-go tier.
The main differences between the two tiers across these models are the rate limits, the pricing on inputs and outputs, whether context caching is provided, and whether the inputs and outputs are used to improve their products.
You can learn more about Gemini’s pricing plans here.
Rate limits
As mentioned previously, the rate limits differ across models and plans. The rate limits are also measured in several ways for each model and plan. More specifically, they’re measured by requests per minute, tokens per minute, and requests per day.
Learn more about Gemini’s rate limits here.
Errors to look out for
While you may experience a wide range of errors, here are a few common ones to be aware of:
- 400 INVALID_ARGUMENT: The request body has a typo, missing field(s), or another issue that’s leading the request to fail
- 404 NOT_FOUND: your requested resource wasn’t found in the server
- 403 PERMISSION_DENIED: your API key doesn’t have the appropriate level of permissions to access the model; and/or you’re trying to access a tuned model without going through the proper authentication process
- 500 INTERNAL: the issue lies on Gemini’s end. You can try making the same request to another model or simply wait and retry the request
Learn more about the API errors you might encounter with Gemini here.
Final thoughts
Your product integration requirements likely extend far beyond Gemini.
If you need to integrate your product with hundreds of 3rd-party applications that fall under popular software categories, like CRM, HRIS, ATS, or accounting, you can simply connect to Merge’s Unified API.
Merge also provides comprehensive integration maintenance support and management tooling for your customer-facing teams—all but ensuring that your integrations perform at a high level over time.Â
You can learn more about Merge by scheduling a demo with one of our integration experts.