To access Gemini models via API, you’ll need a Google AI Studio API key. This guide provides 5 simple steps to obtain one.
Step 1: Sign in to your Google account. You’ll find the sign-in button in the top right corner of the Google homepage.
Step 2: Navigate to Google AI Studio. You can find this landing page at this address. Then, click on the “Gemini API” tab or the “Learn more about Gemini API” button. Alternatively, you can directly access the Gemini API landing page.
Step 3: Click on “Get API key in Google AI Studio”. This button will be prominently displayed in the middle of the page.
Step 4: Review and accept the terms of service. A pop-up window will appear requiring you to agree to the Google API Terms of Service and the Gemini API Supplemental Terms of Service. You can also opt-in to receive email updates on Google AI and participate in Google AI-specific research studies. Check the first box (and the others if desired) and click Continue.
Step 5: Create your API key. You can now click “Create API key”. You will have the option to create the API key in a new project or through an existing project. Once you have chosen one of these options, your API key will be automatically generated!
Remember to store this API key in a secure location to prevent unauthorized access.