Starting April 29, 2025, Gemini 1.5 Pro and Gemini 1.5 Flash models are not available in projects that have no prior usage of these models, including new projects. For details, see Model versions and lifecycle.
A strategy that finds credentials automatically based on the application environment.
More secure; credentials are not hardcoded. Manages credential rotation automatically.
Requires more initial setup and understanding of IAM.
Production and security-sensitive environments.
We recommend using an API key for initial testing and using Application Default Credentials for production. This page shows you how to get a Google Cloud API key based on whether you already have a Google Cloud account.
Select whether you have a Google Cloud account:
Create a Google Cloud API key
If you already have a Google Cloud account, use the following instructions to
get a standard Google Cloud API key.
Before you begin
Concepts
Service Account: A special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs.
API Key: A simple encrypted string that identifies a Google project for purposes of quota, billing, and monitoring.
Authenticate API calls through a service account: Selected.
Click Select service account.
Select the service account you created in the previous step and click Select.
Click Create.
Make your first API request
After getting an API key, learn how to use your API key to make your first
request in the API quickstart.
Optional: Set up your API key locally
For initial testing, you can hard code an API key, but this is not secure and should only be temporary. The following instructions show how to set up your API key locally as an environment variable.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]