How to Get a Gemini API Key
At a Glance
- Target Audience
- Developers and app builders integrating AI models into applications
- Problem Solved
- Obtaining and securely managing a valid Gemini API key for AI integration
- Use Case
- Connecting a custom app or service to Google's Gemini AI models via API
<p>Use this guide if an app asks you for a Gemini API key or Google AI API key.</p>
<p>Gemini API keys are created in Google AI Studio.</p>
<h2 id="what-you-need">What You Need</h2><ul>
<li>A Google account.</li>
<li>Access to Google AI Studio.</li>
<li>A Google Cloud project, if Google asks you to choose or create one.</li>
</ul>
<h2 id="step-by-step">Step by Step</h2><ol>
<li>Go to aistudio.google.com.</li>
<li>Sign in with your Google account.</li>
<li>Accept the terms if Google AI Studio asks you to.</li>
<li>Open the API keys page: aistudio.google.com/api-keys.</li>
<li>Choose the option to create an API key.</li>
<li>If Google asks you to choose a project, select an existing project or create a new one.</li>
<li>Create the key.</li>
<li>Copy the key immediately.</li>
<li>Paste it into the app or service that asked for your Gemini key.</li>
<li>Save your changes in that app.</li>
</ol>
<h2 id="if-you-cannot-create-a-key">If You Cannot Create a Key</h2><p>Check these common issues:</p>
<ul>
<li>You may need to accept the Google AI Studio terms first.</li>
<li>You may need to create or choose a Google Cloud project.</li>
<li>You may not have permission to create keys in the selected project.</li>
<li>Your Google account may be managed by a school, company, or organization that blocks key creation.</li>
</ul>
<p>If you see a message saying you do not have permission, try creating a new personal project or ask the project admin for access.</p>
<h2 id="important-safety-notes">Important Safety Notes</h2><p>Google warns that unrestricted API keys can be risky. If Google AI Studio shows a warning or asks you to restrict the key to the Gemini API, follow the prompt.</p>
<p>Do not publish your key online. If you think it was exposed, delete it and create a new one.</p>
<h2 id="official-source">Official Source</h2><p>Google says Gemini API keys are created and managed from the Google AI Studio API Keys page. Google also notes that keys are connected to Google Cloud projects.</p>
<p>Source: Google Gemini API key docs</p>
