How to build an automated coding assistant with Gemini 3.5 Flash API: a complete 30-minute tutorial
From registering the API to building a multi-step coding workflow, a complete tutorial that can be used even if you have no basic knowledge.
Tutorial Objectives
In 30 minutes, use Gemini 3.5 Flash API to build an automated coding assistant to achieve a three-in-one workflow of code generation, review and refactoring. This article is a complete step-by-step tutorial.
What will you build?
- Coding Assistant Core: Code generation and review system based on Gemini 3.5 Flash
- Automated pipeline: end-to-end workflow from requirement description to code output
- Quality Monitoring: Automatic code review and refactoring suggestions
Preparation list
- Google AI Studio or Gemini API account (free quota available) -Basic Python and terminal operation knowledge
- An API key (get it in 5 minutes)
Overall architecture
The teaching process is broken down into 4 modules and can be advanced in order. When it's all done, you'll have an AI coding assistant that you can actually use.
| Module | Input | Output | Estimated time |
|---|---|---|---|
| Get API Key | Google Account | Gemini API Key | 5 minutes |
| Environment setup | Terminal | Python SDK ready | 5 minutes |
| Core Coding Assistant | API Keys | Code Generation Functions | 12 min |
| Automated Workflows | Coding Functions | Complete Pipeline | 8 Minutes |
Step 1: Get Gemini 3.5 Flash API Key
Gemini 3.5 Flash was just announced today via Google I/O 2026 and is available directly through Google AI Studio. Visit Google AI Studio and log in with your Google account:
- Click "Get API Key" in the upper right corner
- Create or select a project in the Google Cloud Console
- Enable Gemini API and generate API key
- Copy the key and save it to a safe location
#
export GEMINI_API_KEY="_API_"****Gemini 3.5 Flash $1.50/ token $9.00/ token, 2.5 Flash 3 ,。,。
2 Python SDK
Gemini google-genai Python SDK,
# Gemini Python SDK
pip install google-genai
#
python3 -c "import google.genai; print('SDK ready')"API
from google import genai
client = genai.Client(api_key="_API_")
response = client.models.generate_content(
model="gemini-3.5-flash",
contents=" Python "
)
print(response.text[:200]), API 。
gemini-3.5-flash | , preview | |
| $1.50/M tokens | token | |
| $9.00/M tokens | token | |
| 1,000,000 tokens |
3
SDK ,。、
from google import genai
import os
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
def coding_assistant(task_type, input_text):
"""generate / review / refactor"""
prompts = {
"generate": f",
{input_text}",
"review": f",、
{input_text}
__T OK13__
{input_text}
}
response = client.models.generate_content(
model="gemini-3.5-flash",
contents=prompts.get(task_type, input_text),
config={
"temperature": 0.3, #
"max_output_tokens": 4096
}
)
return response.text
# Web
result = coding_assistant("generate", " Python Flask REST API, CRUD ")
print(result[:500])****Gemini 3.5 Flash ——Google 「 agentic coding 」。 Anthropic Claude。
4
——,
import json
from google import genai
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
class CodingPipeline:
def __init__(self):
self.history = []
def generate_code(self, requirement):
step1 = client.models.generate_content(
model="gemini-3.5-flash",
contents=f",
{requirement}"
)
design = step1.text
self.history.append({"step": "design", "output": design[:200]})
step2 = client.models.generate_content(
model="gemini-3.5-flash",
contents=f",
{design}"
)
code = step2.text
self.history.append({"step": "code", "output": code[:200]})
step3 = client.models.generate_content(
model="gemini-3.5-flash",
contents=f"
{code}"
)
review = step3.text
self.history.append({"step": "review", "output": review[:200]})
return {"design": design, "code": code, "review": review}
#
pipeline = CodingPipeline()
result = pipeline.generate_code(" Todo ,、、")
print(json.dumps(result, indent=2))n8n
n8n, AI GitHub Issue、Slack 。 n8n Cloud ,。
AI Claude Code + n8n AI ,He Built an AI Automation Stack with Claude + n8n — $4K to $12K/mo in 6 Months。 A real case of a data analyst using Claude Code + n8n to build an automated report SaaS with a monthly income of $3,800。
(FAQ)
Q1API 429 Too Many Requests?
Gemini API , time.sleep() ,。
Q2?
max_output_tokens ,Gemini 3.5 Flash , 4096 。
Q3Gemini 3.5 Flash Claude Code ?
Gemini 3.5 Flash ()($9/M vs Claude $15/M)。, OpenRouter ,。
SEO+GEOFAQ GEO ,
()
, tools hover-cardGemini、Gemini API、Google AI Studio、Python、n8n、Claude Code、OpenRouter、Google Cloud
Reference video/material
Internal link guidance
- Successful case: He used Claude + n8n to build an AI automation system, He Built an AI Automation Stack with Claude + n8n — $4K to $12K/mo in 6 Months
- Recommended tool: Unified management of multi-model API calls through OpenRouter
Related tutorials
How to Write .cursorrules: Cursor Prompt Engineering Guide (2026)
If Cursor's AI keeps generating code you have to fix every time, the problem is not the model: it is your rules file. A good .cursorrules can cut your edit-to-accept ratio from 3:1 to near 1:1. After eight months of iterating on Cursor rules across React, Python, and Go projects, this guide walks through what works, what breaks, and the templates I actually use.
Claude Code Pricing Guide: Plans, Credits, and Cost Optimization (2026)
I spend $80-150/month on Claude Code and use it 6-7 days a week. This guide breaks down exactly how Claude Code pricing works: per-token API billing, Anthropic credits, Max mode costs, the June 2026 billing change, and real monthly budgets from three developer profiles. I also share the six cost optimization techniques that cut my bill from $340 to $80 without reducing how much I ship.
Topic hub
AI Coding Tools Hub (2026)
From Copilot pricing changes to Claude Code + DeepSeek cost-saving setups—one place to compare tools, read explainers, and follow tutorials.
Explore AI Coding Tools Hub (2026) →Monetization angle
How can you make money from this trend?
WayToClawEarn focuses on verified earn playbooks—not just news. Start from these cases.
AI code review & spec-driven agency
Offer migration consulting as Copilot pricing shifts
Claude Code 48h Micro SaaS
Validate products fast with a low-cost agent stack