PolyCog Try it free
0 of 8 done
Key guide · Google · verified Sep 26, 2026

How to get a Gemini API key from Google AI Studio

About ten minutes. Google gives you a working key the moment you sign in to Google AI Studio, free for the smaller models. Add $5 of prepaid credit and it also runs Gemini 3.1 Pro Preview and web search, and Google stops using what you send to train its models. You pay Google directly at their prices. PolyCog adds nothing.

The short version: aistudio.google.com, accept the Terms (a project and an AQ. key are made for you), Set up billing on that project (Cloud Prepay, $5 minimum, auto-reload off), optional auto-reload with a monthly limit, a monthly spend cap on the Spend page, copy the key, paste, test on Gemini 3.1 Pro Preview.

Never made an API key? Stay here. Every click is spelled out. Condensed steps, direct links, scopes and tier details.

What you need

  • A Google account (a work or school account may need its admin to allow AI Studio)
  • A credit or debit card, for the paid tier (the smallest purchase is $5)
  • A free PolyCog account to save the key in
  • About ten minutes

Google AI Pro, Ultra and the $300 Cloud credit don't cover this

A Google AI Pro or Ultra plan pays for the Gemini app. The $300 Google Cloud welcome credit you're offered along the way "excludes Gemini API", in Google's own words. Apps like PolyCog use the Gemini API, which has its own free tier and its own prepaid credit in Google AI Studio.

The steps

Tick each circle as you finish a step. Your ticks stay in this browser, so you can close the tab and pick up where you left off.

Sign in to Google AI Studio

1 min

Go to aistudio.google.com and choose Get started (top right, or under the big headline). Sign in with your Google account. If you're already signed in to Gmail or YouTube in this browser, Google just asks which account to use.

  • A brand-new Google account may be asked to "Set a home address" first. Choose Skip; it has nothing to do with the API.
  • Google AI Studio is Google's site for developers. It isn't the Gemini app at gemini.google.com, even though both use your Google account.
  • You must be 18 or older to use the Gemini API.
  • aistudio.google.com/welcome › Get started › Google sign-in. Any Google account; Workspace accounts need AI Studio turned on by the admin. Nothing in this guide needs the Cloud console.
Open aistudio.google.com ↗

Accept the Terms

First visit only1 min

On your first visit a Welcome to AI Studio box appears. Tick the first box (it's required), leave the email box as you like, and choose Continue. That's all: Google has already made a project and an API key for you, and you land on the API Keys page with it listed. Seen this before? Tick this step and skip ahead.

Illustrationaistudio.google.com (simplified)
Google AI StudioPricing · Documentation→ Get started Build with Google AI Studio Go from prompt to production with Gemini, Veo, Nano Banana, and more → Get started
1/5Choose Get started
  • Only the first box is required. The second one is about marketing emails.
  • No payment yet. The key Google made (Default Gemini API Key, in Default Gemini Project) already works on the free tier.
  • The Terms box sits over /api-keys: Gemini API Additional Terms, Starter Tier Additional Terms, Privacy Policy; one required acknowledgement, one optional marketing box. Accepting it creates Default Gemini Project (gen-lang-client-…) and Default Gemini API Key, an auth key (AQ., 53 characters) limited to the Gemini API, Billing Tier "Free tier".

Turn on billing

Recommended4 min

Choose Billing in the left menu, then Set up billing. Google asks which project: open the list and choose Default Gemini Project (not Create project or Import project), then Set up billing again. The next few boxes set up a Google Cloud billing account for you:

Set up your Google Cloud Billing account
Check the country, then Agree & continue
Add your billing account details
Add payment method, enter your card, Save card, then Submit
Buy credits
$5 (already picked). Leave Auto-reload off (step 4 covers it). Continue
Payment successful
OK, then Done on "Setup complete"
Illustrationaistudio.google.com › Billing (simplified)
Google AI Studio‹ DashboardProjectAPI KeysProjectsUsage & billingUsageRate LimitSpendBillingObserveLogs and DatasetsA[email protected]
Gemini API Billing No billing accountSet up billing and make prepayment to access higher rate limits, advanced features, exclusive models, and more.Set up billing
Select project Select a project to set up billing Select a Cloud Project ⌄ CancelSet up billing
1/8Billing is in the left menu
  • Google shows a $300 Welcome credit along the way. Its own screens say it "Excludes Gemini API". Only the credit you buy here pays for Gemini.
  • Credit expires a year after you buy it and isn't refundable, so start small. In our test, $5 of credit cost exactly $5.00.
  • Back on API Keys, the key's row now says Tier 1 · Prepay instead of Free tier. The Set up billing link on that row starts the same steps.
  • Billing › Set up billing (or the Billing Tier link on API Keys) › Select project › "Set up your Google Cloud Billing account" (country, Agree & continue) › billing account details (contact, payment method, Submit) › Buy credits (Cloud Prepay; $5 pre-selected / $20 / $100 / Other; Auto-reload toggle off, tagged Recommended) › Payment successful › Setup complete. No Postpay choice is offered to a new account.
  • Credits: Gemini API only, non-refundable, expire a year after purchase. At $0 every key on the billing account stops (HTTP 402); the project doesn't fall back to the free tier. Paid usage isn't used to improve Google's products.
  • The Billing page shows "Paid 1 · $250 Billing Account Tier Cap". Tier 2 after $100 paid + 3 days ($2,000 cap), Tier 3 after $1,000 + 30 days.
Open Billing directly ↗

Choose how it tops up

Recommended2 min

When prepaid credit runs out, every Gemini key on that billing account stops until you add more. Open Billing in the left menu. Under your credit balance it says Auto-reload: Off. Choose Buy credits to add more by hand, or Set up auto reload so Google buys more for you when the balance runs low. The monthly limit is tucked under Monthly limit (optional): open it and set one.

Refill automatically

For regular use, so a debate never stops halfway. In Set up auto-reload:

  1. Reload amount $5
  2. When credit balance falls below $2
  3. Monthly limit (optional) $10

Then Turn on auto-reload. Keep the "falls below" amount under your current balance: Google charges your card right away if it's higher. The monthly limit keeps this from running away, and step 5 adds a spending cap on top.

Keep a hard stop

For trying things out. Leave auto-reload off. When credit reaches zero, the Gemini column shows "Out of API credit" and nothing more is charged. Choose Buy credits on Billing whenever you like.

How much will you use Gemini in PolyCog? A few chats a week on Flash rarely spends $2 a month. Suggested numbers only.
Illustrationaistudio.google.com › Billing › Set up auto reload (simplified)
Google AI Studio‹ DashboardProjectAPI KeysProjectsUsage & billingUsageRate LimitSpendBillingObserveLogs and DatasetsA[email protected]
Gemini API Billing Billing account My Billing Account ⌄ ● Paid 1 · $250 Billing Account Tier Cap1 Project · Default Gemini Project Credit balance$5.00 ▭ Prepay$5.00 added on Sep 26Auto-reload: OffSet up auto reload Buy credits
Set up auto-reload Cloud Prepay 01E1F5-…$5.00 credit balance Prevent interruptions and automatically add credits when your credit balance falls below a specific amount. Reload amount $5$20$100Other amount When credit balance falls below$ 5.00Minimum amount: $1.00. If you set it above your current balance of $5.00, you'll be charged immediately. Monthly limit (optional) ⌄ CancelTurn on auto-reload
1/6Open Billing in the left menu
  • Billing: billing account picker, "Paid 1 · $250 Billing Account Tier Cap", credit balance, Prepay / last top-up / "Auto-reload: Off · Set up auto reload", Buy credits, Transactions, How you pay, Settings.
  • Set up auto-reload: Reload amount ($5 default / $20 / $100 / Other), "When credit balance falls below" (defaults to $5.00, minimum $1.00; above the current balance charges at once), "Monthly limit (optional)" folded, Turn on auto-reload. The checkout's own Auto-reload toggle is off by default and tagged "Recommended". Cut-off lags a little, so the balance can dip below $0 before requests stop.
Open Billing directly ↗

Set a monthly spend cap

Recommended1 min

Open Spend in the left menu. Next to Monthly spend cap, choose Set spend cap, type an amount, say $10, and Save. When the month's spending reaches it, Gemini pauses until the 1st of next month (Pacific time) or until you raise it. Google marks this feature Experimental: it can take about ten minutes to kick in, so spending can go a little over.

Illustrationaistudio.google.com › Spend (simplified)
Google AI Studio‹ DashboardProjectAPI KeysProjectsUsage & billingUsageRate LimitSpendBillingObserveLogs and DatasetsA[email protected]
Gemini API Spend Tier 1 Project Default Gemini Project ⌄ Monthly spend capExperimentalSet spend cap $0.00 / - Overages may occur during ~10 minute latency. Resets on the first day of each month (PST). Your Total CostCosts take a few hours to show up, and might take longer than 24 hours.
Set Gemini API spend cap for Default Gemini Project Your usage will pause when the cap is reached. May be subject to overages for ~10 minute processing window. Monthly spend cap$ Remove spend capCancelSave
1/4Open Spend in the left menu
  • The cap is per project. PolyCog only uses the project your key belongs to, so one cap covers it.
  • Hit the cap mid-month? The Gemini column shows "Monthly spend cap reached". Raise it on the same page, or use Remove spend cap in the same box.
  • The cost figures on this page can run hours behind, so don't worry if a test you just ran doesn't show yet.
  • Spend › Monthly spend cap › Set spend cap, per project (Project picker at the top). Experimental; about 10 minutes to enforce, overage billed; resets on the 1st, Pacific time. Hitting it returns 429 "Your project has exceeded its monthly spending cap." The box has Remove spend cap. "Your Total Cost" lags hours.
  • Also bounded by your tier's monthly cap per billing account ($250 on Tier 1). Cloud Billing budgets only send alerts.
Open Spend directly ↗

Copy the key

1 min

Choose API Keys in the left menu, then the key's short name in blue (it ends in four letters, like …x7Qa). The API key details box opens. Choose Copy key at the bottom right, not Delete key next to it.

Illustrationaistudio.google.com › API Keys (simplified)
Google AI Studio‹ DashboardProjectAPI KeysProjectsUsage & billingUsageRate LimitSpendBillingObserveLogs and DatasetsA[email protected]
API Keys⚿ Create API key KeyProjectBilling Tier…x7Qa
Default Gemini API Key
Default Gemini ProjectMy Billing AccountTier 1 · Prepay
API key details ⓘ For details on using auth keys with Gemini API, see our API key documentation. API KeyAQ.Ab8R…EXAMPLE…x7Qa NameGemini API Key Project nameprojects/7153… Delete keyCopy cURL quickstartCopy key
1/4Choose the key's short name
It starts with AQ.Google's keys used to start with "AIza". Since May 2026 new ones start with AQ. and are 53 characters long, and that's the kind PolyCog wants. Unlike most providers, Google lets you copy the key again any time (the first small icon on the key's row copies it too). Treat it like a password all the same.
  • API Keys › the key's link opens API key details: API Key, Name, Project name, Project number; Delete key, Copy cURL quickstart, Copy key. The row's first icon copies the key directly. Want a separate key for PolyCog? Create API key in the same project (a new project has no billing).
  • Auth keys (AQ.) are tied to a service account and limited to the Gemini API by default, with fast leaked-key shutdown. Unrestricted standard AIza keys are refused; make a new key rather than reuse an old one. PolyCog sends the key in the x-goog-api-key header.
  • A key inherits its project's billing tier. A key in a project without billing is free tier only (no Gemini 3.1 Pro Preview, no search grounding).
Open API Keys directly ↗

Paste it into PolyCog

1 min

Sign in to PolyCog (a free account is enough), open your profile and choose the Keys tab. Paste into Gemini API key and choose Save keys. The button below opens it right here, over this page.

Illustrationpolycog.io › Profile › Keys
ProfileChatsMemorySettingsSavingsKeys
Keys are stored in this browser. Turn on sync to keep them (encrypted) with your account. Claude API keyONsk-ant-… Gemini API keyONHow to get one →AQ.… Save keys
Keys saved
1/2Paste into Gemini API key

Keys stay in the browser you saved them in. If you switch on key sync, they're encrypted and stored with your account so your other devices get them too.

  • Profile › Keys › Gemini API key › Save keys. Per-key on/off switch. Sync is optional (AES-256 at rest).
Open PolyCog key settings →

Run a test

1 min

Pick Gemini 3.8 Flash in the Gemini column and ask something short. An answer means the key works. Turned on billing? Try Gemini 3.1 Pro Preview too: it only answers on the paid tier, so an answer there means billing is on. Got an error? Find its wording under Troubleshooting.

  • Test on gemini-3.8-flash (free tier works), then gemini-3.1-pro-preview (paid tier only; a free-tier key gets 429 with "limit: 0"). Error text maps to Troubleshooting.

What $5 gets you

Rough numbers for one answer (about 1,100 words of question and context in, 750 words out). A debate round costs a little more than a first answer, since each model reads the others.

ModelPrice per 1M tokensin / outOne answerAnswers per $5
Gemini 2.5 Flash-Litecheapest, fast$0.10 / $0.40≈ $0.00055≈ 9,100
Gemini 3.8 Flasheveryday$0.75 / $3.75≈ $0.0049≈ 1,000
Gemini 3.5 Flashlonger thinking$1.50 / $9.00≈ $0.011≈ 440
Gemini 3.1 Pro (preview)deep work, paid tier only$2.00 / $12.00≈ $0.015≈ 330

Web search adds Google's $0.014 per search. Search is paid tier only, and the first 5,000 searches each month are free. Gemini 3.8 Flash is on an introductory price through Dec 31, 2026. The Flash models also run on Google's free tier, within its daily limits. Prices from /pricing/, verified Sep 23, 2026. Assumes 1,500 tokens in and 1,000 out per answer.

Troubleshooting

Find the words from the error in PolyCog's Gemini column.

Your prepayment credits are depleted402 · RESOURCE_EXHAUSTED · PolyCog shows "Out of API credit"
  • The prepaid balance reached $0. Choose Buy credits on Billing, or turn on auto-reload (step 4).
  • Just bought it? Give it a minute, then try again.
  • Before Sep 18, 2026 Google sent this as a 429. Same fix.
API key not valid. Please pass a valid API key.400 · API_KEY_INVALID · PolyCog shows "Invalid API key"

Part of the key is missing, it was deleted, or it's an old key starting with "AIza" that Google no longer accepts. Copy the key again from API Keys (step 6), or make a new one, and paste it again.

Quota exceeded … limit: 0429 · a paid-tier model on a free-tier key · PolyCog shows "Needs the paid tier"
  • You picked a model the free tier doesn't include, most often Gemini 3.1 Pro Preview, or turned on web search. Turn on billing for the key's project (step 3).
  • Already did? The key may belong to a different project than the one you billed. The API Keys page shows each key's project and billing tier.
Your project has exceeded its monthly spending cap429 · your own spend cap · PolyCog shows "Monthly spend cap reached"

This month's spending reached the cap you set in step 5. Raise it on the Spend page (or choose Remove spend cap), or wait for the 1st of the month, Pacific time. Google marks the cap Experimental, so if you're sure you're under it, give it ten minutes and try again.

You exceeded your current quota429 · RESOURCE_EXHAUSTED · a rate limit

Too many requests too quickly. The free tier's limits are low, and Tier 1 has a per-minute ceiling too. Wait a minute, run fewer Gemini columns at once, or turn on billing for higher limits. The Rate Limit page in AI Studio shows yours.

User location is not supported for the API use400 · FAILED_PRECONDITION · PolyCog shows "Not available here"

The Gemini API isn't offered everywhere, and in some countries the free tier isn't ("Gemini API free tier is not available in your country"). Turning on billing fixes the second one.

Your API key was reported as leaked. Please use another API key.403 · PERMISSION_DENIED

Google found the key somewhere public (a website, some code, a screenshot) and switched it off. Delete it on the API Keys page, make a new one with Create API key, and paste that into PolyCog.

Permission denied403 · PERMISSION_DENIED · an old or blocked key

Usually an old "AIza" key that isn't limited to the Gemini API, which Google now refuses. Make a new key in AI Studio and paste that. If a new key fails the same way, the project itself is blocked: create the key in another project and turn on billing there.

The model is overloaded. Please try again later.503 · UNAVAILABLE

Google is busy. It isn't your key or your credit. Try again in a moment, or pick a different Gemini model.

Where's my key?closed the window before copying

Google keeps it for you. Open API Keys, choose the key's short name and choose Copy key again (the first small icon on the key's row copies it too). If someone else may have seen it, delete it and make a new one instead.

Questions people ask

Is the Gemini API free?

Partly. The free tier runs the Flash models within low daily limits, and Google's own welcome box says prompts and responses "may be reviewed and used to train Google AI". Gemini 3.1 Pro Preview, web search and higher limits need prepaid credit, $5 at the least. An everyday answer on Gemini 3.8 Flash costs about half a cent.

Where do I find my Gemini API key again?

In Google AI Studio, choose API Keys in the left menu, then the key's short name, then Copy key. Unlike most providers, Google lets you copy a key again any time.

Why does my Gemini API key start with AQ.?

Since May 2026 Google AI Studio makes a newer kind of key, an auth key, that starts with "AQ." and is limited to the Gemini API. Older guides show keys starting with "AIza"; Google now refuses the unrestricted ones. PolyCog works with AQ. keys.

Does Google AI Pro or Ultra include API access?

No. Those plans cover the Gemini app and other Google products. The API is billed separately in Google AI Studio, even on the same Google account.

Can I use the $300 Google Cloud welcome credit?

No. Google offers it while you set up billing, and its own screens say it "excludes Gemini API". It's for other Google Cloud products.

Do Gemini API credits expire?

Yes. Prepaid credit expires a year after you buy it, can only be used for the Gemini API, and isn't refundable.

Do I pay up front or get a bill?

Up front. A new account goes straight to prepaid credit (Google calls it Cloud Prepay) with no other choice offered. It can't spend more than you've put in unless you turn on auto-reload.

What's a Google Cloud project? Do I need the Cloud console?

A project is the folder your key and billing belong to. AI Studio made one for you (Default Gemini Project), and everything in this guide happens in AI Studio. You never need to open the Cloud console.

Does Google use my prompts?

On the free tier, yes: prompts and responses may be reviewed and used to train Google AI. On the paid tier, Google says it doesn't use your prompts or responses to improve its products.

Is it safe to give PolyCog my key?

PolyCog sends it only to Google, only for requests you start. It's kept in your browser, and encrypted if you turn on key sync. The key only works for the Gemini API, you can delete it in AI Studio at any time, and the prepaid balance and spend cap limit what it can ever cost.

Keys for the other seats

Key in hand? Put it to work.

PolyCog puts up to six AI models on the same question, lets them debate, and has the one you pick write the answer. Your keys, provider prices, no markup.

Free tier forever · $10/mo · $250 lifetime · your API keys, your bill

Verified at Google's help center, developer docs and platform on Sep 26, 2026. Google moves things around; spotted a change? Send a correction. Screens are simplified drawings, not screenshots. Not affiliated with Google. All guides → · Models → · Pricing →