Latest news
TutorialsGemini APIMariGoogle

Architectural Workflows with the Gemini API: Your First Text Request in Python

In this tutorial, you’ll learn how to send a text request from Python using the Gemini API’s Interactions API. It covers setup, API keys, architecture-focused prompt examples, and streaming responses.

Plans, material samples, and a laptop on an architectural design deskAI image
Representative image, generated with AI.Image: 3dsınıfı / FCA AI

In brief

  1. You can get a Gemini API key through Google AI Studio.
  2. Install the `google-genai` SDK with pip for the Python example.
  3. The request example uses the `gemini-3.8-flash` model and the Interactions API.
  4. To move to the paid tier, you need to set up Cloud Billing and make a prepayment of at least $5.

What will you learn in this tutorial?

This guide is for architecture, interior design, and visualization teams who want to send their first text request to the Gemini API using Python. We’ll show you how to create a prompt with Google’s Interactions API, read the resulting text, and receive the response as a stream. The examples focus on text-based tasks that might come up during the design process, such as requesting ideas for a small residential living room or preparing for a café concept meeting.

The code examples in this tutorial are designed to return text. The Gemini API can do more than that: Google’s getting started guide also lists multimodal understanding, image generation, structured output, and tool use among the capabilities available through the API. However, the text outputs shown here are not a substitute for drawings, renders, or technical verification; project decisions should be reviewed by the team.

Requirements: account, key, and software

To get started, obtain an API key through Google AI Studio. According to Google’s guide, AI Studio can automatically create a project and key for new users; existing users can create a new key-project pairing from the API keys page. The guide also notes that projects imported from Google Cloud may need to be verified to use the free tier.

This tutorial uses the Python SDK. The installation command provided in the source installs or updates the google-genai package. Since the guide does not specify a Python version requirement, no additional version requirement is given here. Instead of putting your API key directly in your source code, set it as an environment variable:

bash
export GEMINI_API_KEY="YOUR_API_KEY"

Replace YOUR_API_KEY with your own key. This command sets the key as GEMINI_API_KEY in the environment where the command is run. To control access, avoid adding the key to public code repositories or files accessible outside your team.

To move to the paid tier, you need to set up Cloud Billing, add a payment method, and prepay for at least $5 or the equivalent in paid credits. Google says the paid tier increases rate limits. You can monitor API usage from the usage page in Google AI Studio.

Send your first request step by step

  1. Install the SDK. Run the following command in your Python environment:

bash
pip install -U google-genai

The command installs the google-genai package with pip or updates an existing installation. If you use multiple Python environments, make sure to run it in the environment where the code will run.

  1. Prepare your first text request. Add the example below to a Python file. The prompt asks for written suggestions for a small residential living room:

python
from google import genai

client = genai.Client()
interaction = client.interactions.create(
    model="gemini-3.8-flash",
    input="Küçük bir konut salonu için gün ışığını ve dolaşımı gözeten üç tasarım önerisi yaz. Her öneride tasarım kararını ve gerekçesini belirt."
)
print(interaction.output_text)

The request is sent to the gemini-3.8-flash model through the Interactions API; the example prints the result using interaction.output_text. You can adapt the prompt to the text task your actual workflow requires. For example, you could request a concept description for a presentation, a draft comparing material options, or a list of questions for a client meeting. Clearly specifying the expected scope and format makes it easier to assess the response.

  1. Narrow the prompt to your project context. Instead of using a generic instruction, specify the type of space and the output you want. The example below is an original prompt for preparing for an interior design meeting:

Prompt
Bir kafe iç mekânı için konsept geliştirme toplantısına hazırlanıyorum. Tasarım ekibinin tartışması için üç farklı atmosfer yönü öner. Her yönü kısa bir başlık, mekânsal yaklaşım ve müşteriye sorulacak iki net soruyla açıkla. Proje verisi verilmediğinde varsayım üretme; eksik bilgileri ayrıca belirt.

This prompt asks for a written draft to discuss at a meeting, not a visual or technical output. Asking it to identify unknowns separately may help prevent the response from being mistaken for project data; the team should still review the generated text.

  1. Receive the response as a stream. If your application needs to process the response in chunks as it is generated, you can use stream=True in the request. The example below iterates through events returned by the API and prints them:

python
from google import genai

client = genai.Client()
stream = client.interactions.create(
    model="gemini-3.8-flash",
    input="Bir mimari konsept sunumu için kısa bir açılış metni yaz.",
    stream=True
)
for event in stream:
    print(event)

With streaming, the response arrives as a series of events rather than as a single text string. Google’s guide explains that step.delta events can carry text chunks as the response is generated. This example prints each event directly; when developing an application, you’ll need to decide separately how to present the events to users.

Use in architecture and visualization workflows

These examples can be a starting point for text-based tasks such as drafting concept descriptions, generating questions to support a meeting agenda, comparing design options in writing, and preparing presentation copy. A team can choose one clearly scoped, recurring task and assess how much editing the output needs. This approach does not establish anything about the API’s image generation or project verification capabilities; it only tests whether the text requests shown here fit the workflow.

These examples do not measure local render performance. Since the source provides no specific GPU requirement or hardware recommendation for this use case, don’t make device upgrade decisions based on these examples. On the account side, it’s important to manage the API key, monitor usage, and, if needed, evaluate the cost of the paid tier. Switching to paid use requires Cloud Billing and prepayment, so it’s useful for teams to define usage responsibilities and budget tracking in advance.

Common mistakes and next steps

  • The key isn’t set: Run the Python file in the environment where GEMINI_API_KEY is defined.

  • The package was installed in a different environment: Check that google-genai is installed in the Python environment running the code.

  • The prompt is too general: Specify the type of space, the purpose of the requested text, and the response format.

  • Treating the response as approved project information: Don’t treat the text as a design decision or technical verification; have the team review it.

  • Starting paid use without a plan: Review the Cloud Billing and prepayment requirements before switching to paid use.

Once your first request works, choose a clearly defined text task that the team repeats often instead of immediately building a comprehensive automation. Refine the prompt in small steps, and track the usefulness of the results, the amount of editing required, and API usage. Google’s guide also describes SDKs for application development and the Gemini API CLI for scripts or command-line tasks that call the API directly. The code examples in this tutorial are limited to the Python SDK and Interactions API.

Source and license

This tutorial has been adapted into Turkish using Google’s “Getting started” guide for the Gemini API (K1). The source is published under the CC BY 4.0 license. The architecture- and interior-focused example prompts were created specifically for this tutorial.

Sources

1 source
A(
ai.google.dev (CC BY 4.0)ai.google.dev/gemini-api/docs/interactions/quickstart.md.txt
Summary

Source texts are not republished; short quotes are marked, everything else is our own summary and commentary.

3dsınıfı’s take
3dEditor’s assessment

For architecture offices and visualization teams, the practical value of this workflow is that it lets them use an API to handle recurring text tasks through small experiments. Whether it actually saves time on tasks such as describing a concept or preparing for a meeting should be assessed with the project team’s review.

Before moving to paid use in Turkey, it’s important to clarify the Cloud Billing requirements, prepayment, and usage monitoring. The examples don’t show a workflow that requires a local GPU upgrade, so there’s no basis for assuming a hardware investment is needed. Protecting the API key and defining who is responsible for API usage within the team should also be part of the plan.

Frequently asked questions

Which package should I install to use the Gemini API with Python?

Google’s getting started guide uses the `google-genai` SDK. The installation command is `pip install -U google-genai`.

How do I get an API key for the Gemini API?

You can create an API key in Google AI Studio. The key is needed to authenticate API requests and associate usage with your account.

What do I need to move to the paid tier of the Gemini API?

You need to set up Cloud Billing, add a payment method, and prepay for at least $5 or the equivalent in paid credits.

Comments and the forum are in Turkish.Join the discussion
+

Related news