Google AI Studio Guide: First Prompt to Gemini API
Learn Google AI Studio step by step with official docs: your first chat prompt, Run settings, Build mode, Get code, and keeping your Gemini API key safe.
Google AI Studio is useful for two things: quickly trying out models and prompts in your browser, and then turning a validated idea into Gemini API code through Get code. Many people who search for google studio ai or gemini ai studio mix up AI Studio, the Gemini chat interface, and the API. This article separates the three first, then walks you through a minimal first test. The content is based on Google's official documentation as verified on September 21, 2026; interface text may change with new versions.
1. What Is Google AI Studio?
Google AI Studio is a development interface for quickly trying out models, designing prompts, and building prototypes. The core flow in the official quickstart is: open AI Studio, create a prompt, test it repeatedly, then use Get code to get a code sample in your preferred language and connect it to the Gemini API.
You can tell the three terms apart like this:
- Google AI Studio: a browser workspace for trying prompts, adjusting settings, and creating or sharing prototypes.
- Gemini models: the models that actually generate text, images, audio, or other output; different models have different capabilities and input/output formats.
- Gemini API: the programming interface you use when you put a workflow validated in AI Studio into your own website, service, or script.
So, a stable prompt tested in AI Studio does not mean your backend is finished. To put it into an application, you still need to use Get code, set up your key, confirm the model, and handle errors.
If you want to first understand the basic concepts of API integration, you can read the AI API Beginner's Guide on this site; if you care about the prices and versions of different Gemini models, see Gemini API Pricing and Free Quota Overview. This article does not repeat prices.
2. Testing Your First Chat Prompt in AI Studio
The official quickstart uses a Chat prompt as its example. For beginners, you can follow these steps:
- Open Google AI Studio and start a new chat prompt.
- In Run settings, find System Instructions and first write the role, task, output format, and constraints.
- Enter an easy-to-check question in the input box and press Run to get a result.
- Change only one condition, send the same question again, and observe where the answer changed.
- Once the output is stable, save the prompt or press Get code to continue development.
For example, instead of asking for a "complete customer service system" right away, you can start with this test:
You are a product documentation assistant.
Organize the user's input into three columns: Issue, Known Information, and Items to Follow Up On.
If the information is insufficient, clearly write "Needs follow-up" and do not make up facts.
Then enter a short piece of text and see whether the model follows the three-column format. This example tests "can it consistently follow the format" first, which makes problems easier to locate than aiming for long answers from the start.
3. Which Run Settings Features Should You Choose?
The official documentation lists model parameters and safety settings under Run settings. Depending on the interface and model support, you can also turn on tools such as structured output, function calling, code execution, and grounding.
You can understand them in this order:
- System Instructions: define the role, task, tone, format, and what the model must not do.
- Model parameters: control output style or randomness; keep them simple at first, and adjust them only after you have comparable test questions.
- Structured output: use it when you need fixed JSON or fields, but still validate the format in your program.
- Function calling: use it when the model needs your program to run a query or action; the permissions and input validation of the function remain your program's responsibility.
- Code execution, grounding: turn these on only when the task truly needs calculation, code execution, or external data, and record the input and the result sources.
Not every model supports the same features. This article has not checked every switch on every account and every model in the interface as of the day, so that part is marked unverified. Do not assume your model supports a capability just because a button appears on a tutorial screen.
4. How to Use AI Studio Build Mode
Beyond chat prompts, the official site also provides documentation for AI Studio Build mode. You can describe the app you want in natural language, have the system generate files and a previewable app, and then add features step by step. This suits turning an idea into a clickable prototype, such as a form, a simple data-organizing tool, or an interactive page.
A safer way to use it is:
- Clearly describe the users, the main flow, and what is out of scope.
- Ask for a minimal runnable version first, rather than adding login, payments, a database, and every integration at once.
- Test each item in the live preview, and note the errors and the steps to reproduce them.
- When you need external APIs or secret data, use the Secrets settings and server-side code; do not put keys in browser code.
- Before deploying or sharing, review the generated files, dependencies, permissions, and API calls.
The official Build mode documentation explains that AI Studio can set the Gemini API key as a server-side secret, and can also export or deploy the app. However, the permissions, costs, and data handling after deployment to an external environment remain the responsibility of your own project settings.
5. What to Watch For When Moving from Prototype to Gemini API
When a prompt gives acceptable results in AI Studio, press Get code to get a code sample, and then check the following:
- Whether the model ID you use still appears in the official model documentation and in the actual public model list.
- Whether the API key is stored in an environment variable or a secret manager, not hard-coded in the frontend or in Git.
- Whether your backend validates input, limits output length, and handles timeouts and errors.
- When you need JSON, function calls, or tools, whether you validate the model output again on the server side.
- Whether you record enough request IDs, model IDs, and result statuses to troubleshoot later.
Google's official API key documentation recommends the GEMINI_API_KEY or GOOGLE_API_KEY environment variables, and explicitly warns against exposing the key in client-side code in production. This article uses only environment variable names and does not include any actual key. If you see an older example that hard-codes the key in browser code, change it to backend or secure secret management first.
6. Which Gemini Model IDs Has BazaarLink Found So Far?
Before writing this article, we queried https://bazaarlink.ai/api/v1/models on September 21, 2026. The public list showed gemini-2.5-flash, gemini-2.5-pro, and gemini-3.8-flash, and also the image-related gemini-2.5-flash-image, gemini-3.1-flash-image, and gemini-3-pro-image. These are the IDs that actually appeared in that public list at the time; this does not mean every account, every API format, or every multimodal capability has been verified one by one.
If you have already verified a prompt in AI Studio, your next step is to confirm that your program's interface and the target gateway both support the same input and output format, and then choose a model ID from the list that still exists at that time. Do not treat AI Studio display names as IDs for any third-party endpoint, and do not permanently hard-code the IDs listed in this article into your product documentation.
Official Verification Sources (verified: September 21, 2026)
- Google AI for Developers: Google AI Studio quickstart
- Google AI for Developers: Build apps in Google AI Studio
- Google AI for Developers: Using Gemini API keys
- Google AI for Developers: Gemini API models
- BazaarLink public model list
Unverified items: the full set of feature switches shown in AI Studio on that day for individual accounts, regions, and models; the individual permissions, quotas, and billing status after an AI Studio prototype is deployed to an external environment; and the complete multimodal capabilities of the model IDs above under your chosen API format. This article does not cite prices.
FAQ
What is Google AI Studio?
Google AI Studio is a development interface for testing models, designing prompts, adjusting settings, and building prototypes. After validation, you can use Get code to extend the work into the Gemini API.
What should I do the first time I use Google AI Studio?
Create a Chat prompt, write System Instructions in Run settings, enter a question that is easy to check, and press Run. Then change only one condition at a time and compare the results.
What is Get code in Google AI Studio used for?
Get code turns a prompt and settings you tested in AI Studio into Gemini API examples in your preferred programming language. You still need to handle keys, errors, and input validation yourself.
Can I put a Gemini API key directly in the frontend?
Not recommended. Google's official guidance is to use the GEMINI_API_KEY or GOOGLE_API_KEY environment variable and to avoid exposing the key in client-side code in production.
Which BazaarLink Gemini model IDs were found on September 21, 2026?
The public list showed gemini-2.5-flash, gemini-2.5-pro, and gemini-3.8-flash, plus gemini-2.5-flash-image, gemini-3.1-flash-image, and gemini-3-pro-image. Query again before use.
TWD billing · Taiwan invoices · leading AI models · OpenAI-compatible API