Getting a Google Gemini API Key
Last updated
Google Gemini is one of Premail's cloud AI options, and the quickest to set up if you already have a Google account: Google AI Studio creates a key for you in a couple of clicks. This guide covers making the key, choosing between the free and paid tiers, and fixing the errors you are most likely to see.
How do you create the key?
- 1Open aistudio.google.com/api-keys and sign in with your Google account. A work or school account may need an administrator to allow AI Studio first.
- 2New accounts get a default project and key automatically. Otherwise click Create API key and pick a project, or let AI Studio make one.
- 3Copy the key. You can open it again from the same page later, so there is no rush.
- 4In Premail, open the AI Model tab (or the AI step of setup), choose Google Gemini, and paste the key. Premail loads the models the key can use and selects Gemini 3.5 Flash-Lite.
- 5Click Save. Premail makes one small test request to confirm the key works before it starts classifying mail.
Should you use the free tier or set up billing?
Set up billing if you can. A key with no billing runs on Google's free tier, and Google's terms let it use free-tier requests, which for Premail means each email's sender, subject, and text, to improve its products. Human reviewers may read them. With billing set up, Google does not use your requests that way. People in the European Economic Area, Switzerland, and the United Kingdom get the paid-tier terms either way.
The free tier also has a daily request limit. When you reach it, Premail shows a banner and leaves new mail in your inbox untouched until the limit resets or you add billing.
- 1In AI Studio, find the key's project on the API Keys or Projects page and click Set up billing.
- 2Pick or create a Google billing account. New accounts usually prepay a minimum of $5.
- 3Check the tier on the Billing page. You do not need a new key: the same key moves to the paid tier.
What does it cost?
Gemini 3.5 Flash-Lite, Premail's recommended Gemini model, costs roughly $4 per 1,000 emails classified on a paid key (about $12 a month at 100 emails a day), so $5 of prepaid credit covers over 1,000 emails. Larger Flash and Pro models are more expensive and rarely classify mail noticeably better. Premail's AI Model tab tracks your running spend estimate, and the hourly call cap stops a flood of mail from running up a surprise bill.
What if the key doesn't work?
- "API key not valid": copy the key again from AI Studio in one piece. Premail trims spaces at the ends but cannot fix a partial paste.
- "Resource exhausted" or "exceeded your current quota": the free tier's limit is used up, or a prepaid balance is empty. Set up billing or add credit, or wait for the limit to reset.
- A model is not found: Google retires model names over time. Click Refresh next to the model list and choose one it shows.
- No Create API key button: your Google Workspace administrator has to allow API key creation for your account.
Still have questions?
Contact Support (for Pro members)