Quick Answer
Google AI Studio vibe coding happens in Build mode, which turns a prompt into a full-stack web app (React in the browser, Node.js on the server) or a native Android app. Google's docs say your Gemini API key is stored as a server-side secret and never sent to the browser, including in shared apps and Cloud Run deployments. Hidden is not the same as protected: a published app is public, and it spends your key's quota for every visitor. Before you publish, decide who can call it, set a spend cap, review the database rules and test the headers.
What Google AI Studio Vibe Coding Is
Google introduced vibe coding in AI Studio in October 2025, then launched a full-stack version in March 2026, built on the Google Antigravity coding agent.
According to Google's Build mode documentation, you can start from a prompt, the I'm Feeling Lucky button, a remixed App Gallery project or a GitHub import. What you get depends on the platform you pick:
- Web apps (the default): a React frontend and a Node.js server. The agent installs npm packages, keeps API keys in a Secrets panel and can set up Firebase Firestore and Firebase Authentication with Sign in with Google.
- Android apps: a Kotlin and Jetpack Compose project you can preview in a browser emulator and publish to the Play Store internal testing track, per the Android guide.
From Prompt to a Live App
An app is private by default. People you share it with can use it, see its code and fork it, and their API calls count toward your usage limits.
When the app is ready, you publish it to Cloud Run. Google's deployment page describes two routes:
- Google Cloud Starter Tier: eligible accounts can publish up to 2 full-stack apps without a Google Cloud project or billing account, in a single Cloud Run region. Workspace accounts and accounts with paid Cloud billing history may not qualify.
- Standard deployment: needs a Google Cloud project linked to AI Studio, with billing enabled.
You can pick a custom subdomain such as your-app-name.ai.studio, released for anyone to claim if you unpublish or delete the app. You can also download the code as a ZIP file or sync it both ways with GitHub.
One line in Google's Cloud SQL guide for AI Studio matters more than the rest: "Publishing the application exposes it publicly to the internet."
How AI Studio Handles Your Gemini API Key
Here is what Google's docs say for each place your app can run, checked on 24 October 2026:
| Where the app runs | What the docs say about the key |
|---|---|
| Building in AI Studio | GEMINI_API_KEY is set up for you as a server-side secret, shown in the Secrets panel, and never included in client-side code |
| Shared with other users | They can use the app but cannot see your key. Their calls count toward your limits |
| Published to Cloud Run | The key sits in the server-side environment, and the app uses it for every user's Gemini calls |
| Downloaded as a ZIP | You set GEMINI_API_KEY yourself in your hosting environment |
| Android app | Firebase AI Logic and App Check replace the raw key, so no credentials go into the APK |
| App built before 14 May 2026 | The agent moves it to the server-side approach the next time you change the app's Gemini features |
Sources: Build apps in Google AI Studio and Develop full-stack apps.
So the key stays off the browser. The catch is on the same page: "The deployed app will use your API key for all users' Gemini API calls." On a public URL, every visitor, and every script that finds the URL, spends your quota. The docs do not say whether the server code the agent writes checks who is calling or limits how often. Read that route yourself, and see our guide to missing rate limiting on API endpoints.
The docs also do not say how apps built before 14 May 2026 handled the key, or whether secrets stay out of a ZIP export or a GitHub sync. Check all three in the code. Google's API key page sets the rules: never commit keys to Git, never hardcode them in web or mobile apps, and run a backend proxy for client-side apps. Our guides to client-side secret exposure and hardcoded API keys show how keys slip into bundles.
// BAD: a VITE_ variable is bundled into the browser code, so any visitor can read the key
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({ apiKey: import.meta.env.VITE_GEMINI_API_KEY });
// GOOD: the key stays on the server, and the route checks who is calling and how often
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
const DAILY_LIMIT = 20;
const callsPerUserDay = new Map<string, number>(); // use your database if you run more than one instance
export async function ask(userId: string | null, input: string) {
if (!userId) return { status: 401, body: "Sign in first" };
const key = `${userId}:${new Date().toISOString().slice(0, 10)}`;
const used = callsPerUserDay.get(key) ?? 0;
if (used >= DAILY_LIMIT) return { status: 429, body: "Daily limit reached" };
callsPerUserDay.set(key, used + 1);
const interaction = await ai.interactions.create({ model: "gemini-3.8-flash", input });
return { status: 200, body: interaction.output_text };
}
One key in your code is expected. Firebase's AI Studio integration page says the Firebase browser key can live in your config if its API allowlist covers Firebase services only, without the Generative Language API. The Gemini key must never be in your code or config files.
Costs and Quotas, in Google's Words
Every Gemini API key belongs to a Google Cloud project, which carries the bill, and rate limits apply per project, not per key. These are the controls Google documents, checked on 24 October 2026:
| Control | Where | What it does |
|---|---|---|
| Project spend cap | AI Studio, Spend page | Monthly cap per project. Experimental, with overages possible for about 10 minutes |
| Prepay balance | AI Studio, Billing page | At $0, all API keys in all projects on that billing account stop, with an HTTP 402 error |
| Monthly auto-charge limit | AI Studio, Billing page | Caps automatic top-ups in a month |
| Tier spend cap | Set by Google per billing account | $250 a month on Tier 1, $2,000 on Tier 2, $20,000 to $100,000 on Tier 3 |
| Budget alerts | Cloud Billing | Email alerts only. They do not cap usage or spending |
| Cloud Run maximum instances | Cloud Run settings | Limits scaling, which Google lists as a way to control costs. Default 100 per revision |
Sources: Gemini API billing, Cloud Billing budgets and Cloud Run maximum instances.
New accounts start on the Free Tier. Moving to a paid tier means linking a billing account and prepaying at least $5. Depending on your billing history, paid tiers may also have spend-based rate limits over a rolling 10 minutes: $10 on Tier 1, $50 on Tier 2 and $200 on Tier 3. Cloud Run pricing may also apply to the hosting, based on usage.
The database has its own ceiling. Firestore databases the agent creates share one quota group: 1 GiB stored, 40,000 writes and 50,000 reads a day. Hit a daily limit and every database in the group pauses until about midnight Pacific Time.
What Happens to the Data Your Users Type
When your app passes a visitor's input to Gemini, it goes under your key, so your project's billing status decides which data terms apply. The Gemini API terms say that on Unpaid Services, which include the free quota, Google uses prompts and responses to improve its products, and human reviewers may read them. The instruction is direct: "Do not submit sensitive, confidential, or personal information to the Unpaid Services." On Paid Services, Google does not use prompts or responses to improve its products. In the EEA, Switzerland and the UK, the paid data terms apply to all services.
For storage, the agent writes Firestore Security Rules that deny access by default, so each user can reach only the data they own. Firebase still warns that Google and Firebase are "not liable for any security vulnerabilities in AI-generated Security Rules", and asks you to review and test them before production. If you edit the rules in the Firebase console, the agent will not know, and later iterations overwrite them. Google's Build page is clear that the owner is responsible for the app's behaviour and all data it handles.
Checklist Before You Publish
- Watch the network. Open the live app and the browser's network tab, then use the AI feature. Requests should go to your own server, not straight to generativelanguage.googleapis.com with an x-goog-api-key header.
- Search the files. In the ZIP or synced repo, search the code and its history for the first characters of your key, copied from the Secrets panel.
- Check older apps. Built before 14 May 2026 and Gemini features untouched since? Read how the code loads the key.
- Decide who can call it. If the app is just for you or a few people, share it inside AI Studio instead of publishing. Shared users can see the code. If it must be public, add sign-in and a per-user limit on the route that calls Gemini.
- Cap the money. Set a project spend cap in AI Studio, a budget alert in Cloud Billing and, on Prepay, a monthly auto-charge limit.
- Test the rules. Sign in with a second account and try to read the first account's records.
- Mind the free tier. If users will type personal details, move the project to a paid tier first.
- Test the headers. None of the AI Studio pages we read mention security headers, so check what your URL sends. See missing security headers for what each one does.
# Which security headers does your published app send?
curl -sI https://your-app.ai.studio | grep -iE "strict-transport-security|content-security-policy|x-frame-options|x-content-type-options|referrer-policy"
# Search the synced repo and its history for your key (paste its first characters)
git grep -n "FIRST_CHARS_OF_KEY"
git log -p -S "FIRST_CHARS_OF_KEY" --oneline
Tools like VibeDoctor's Vibe Check (vibedoctor.io) automatically scan your synced GitHub repository and your published app: secrets via Gitleaks and its own secret checks, dependency CVEs via Trivy, and on the live site security headers, SSL, console errors and privacy policy and terms, with specific file paths and line numbers. Free to sign up.
For the wider list, work through our vibe coding security checklist.
FAQ
Is Google AI Studio vibe coding free?
Building is. Google's billing FAQ says AI Studio usage stays free of charge unless you link a paid API key, and eligible accounts can publish up to 2 apps on the Starter Tier without a billing account. Paid models and Cloud Run usage can cost money (checked on 24 October 2026).
Does Google AI Studio expose my Gemini API key?
Not according to Google's docs. The key is a server-side secret and is never included in client-side code, even when you share or deploy. But a published app uses your key for every visitor's Gemini calls, so limit who can call it and cap your spend.
What should I do if my Gemini API key leaks?
Google's checklist: create a new key, deploy your app with it, then disable the leaked key once the new one works. Do not delete the old key before that, to avoid downtime. Then check billing and API usage in the Cloud console for unauthorised activity.
Where can an AI Studio app store data?
The agent can set up Firestore, and the Starter Tier includes Cloud SQL for PostgreSQL (developer edition). Google's Build FAQ adds that any storage reachable over a network works, unless a firewall blocks dynamic IP ranges.