The Gemini 3.6 Flash API is one of the fastest and most cost-effective ways to add AI capabilities to your applications. With a 1M token context window, multimodal input support, built-in computer use, and pricing at $1.50/$7.50 per million tokens, it is a strong choice for developers building production-grade AI features.
This guide gets you from zero to your first Gemini 3.6 Flash API call in under 5 minutes. If you have used the 3.5 Flash API before, the setup is identical, just change the model name.
Step 1: Get Your API Key
- Go to Google AI Studio
- Sign in with your Google account
- Click βGet API Keyβ in the left sidebar
- Create a new API key or use an existing one
- Copy the key
The API key gives you access to the free tier with rate limits. For production use, you will need to set up billing.
Step 2: Install the SDK
Python:
pip install google-genai
Node.js:
npm install @google/genai
Step 3: Make Your First Request
Python:
from google import genai
client = genai.Client(api_key="YOUR_API_KEY")
response = client.models.generate_content(
model="gemini-3.6-flash",
contents="Explain how async/await works in JavaScript."
)
print(response.text)
Node.js:
const { GoogleGenAI } = require("@google/genai");
const ai = new GoogleGenAI({ apiKey: "YOUR_API_KEY" });
async function main() {
const response = await ai.models.generateContent({
model: "gemini-3.6-flash",
contents: "Explain how async/await works in JavaScript.",
});
console.log(response.text);
}
main();
cURL:
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.6-flash:generateContent?key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [{"text": "Explain how async/await works in JavaScript."}]
}]
}'
That is it. You are now using Gemini 3.6 Flash.
Step 4: Configure Generation Parameters
Control the output with generation config:
response = client.models.generate_content(
model="gemini-3.6-flash",
contents="Write a Python function that validates email addresses.",
config={
"temperature": 0.7, # Creativity (0.0-2.0)
"max_output_tokens": 2048, # Max response length
"top_p": 0.95, # Nucleus sampling
"top_k": 40, # Top-k sampling
}
)
For coding tasks, use lower temperature (0.2-0.5) for more deterministic output. For creative tasks, use higher temperature (0.7-1.0).
Step 5: Use Thinking Mode
Gemini 3.6 Flash supports extended reasoning for complex tasks:
response = client.models.generate_content(
model="gemini-3.6-flash",
contents="Find the bug in this code and explain the fix step by step.",
config={
"thinking_config": {"thinking_budget": 8192}
}
)
# Access thinking content
for part in response.candidates[0].content.parts:
if part.thought:
print("Thinking:", part.text)
else:
print("Response:", part.text)
The thinking_budget controls how many tokens the model uses for internal reasoning. These tokens are not counted toward output billing. Use thinking mode for complex coding, math, and multi-step planning tasks.
For speed-sensitive workflows where deep reasoning is not needed, leave thinking mode off.
Step 6: Stream Responses
For better user experience, stream the response:
Python:
response = client.models.generate_content_stream(
model="gemini-3.6-flash",
contents="Write a tutorial on Python decorators.",
)
for chunk in response:
print(chunk.text, end="")
Node.js:
const response = await ai.models.generateContentStream({
model: "gemini-3.6-flash",
contents: "Write a tutorial on Python decorators.",
});
for await (const chunk of response) {
console.log(chunk.text);
}
Streaming is essential for interactive applications. Users see tokens appear immediately instead of waiting for the full response.
Step 7: Use Multimodal Input
Gemini 3.6 Flash accepts text, images, video, audio, and PDF input:
from google.genai import types
# Image input
with open("screenshot.png", "rb") as f:
image_data = f.read()
response = client.models.generate_content(
model="gemini-3.6-flash",
contents=[
types.Part.from_bytes(data=image_data, mime_type="image/png"),
"Describe what is in this screenshot."
]
)
# PDF input
with open("document.pdf", "rb") as f:
pdf_data = f.read()
response = client.models.generate_content(
model="gemini-3.6-flash",
contents=[
types.Part.from_bytes(data=pdf_data, mime_type="application/pdf"),
"Summarize the key points in this document."
]
)
This is a major advantage over models that only accept text and images. See our Gemini 3.6 Flash vs Claude Sonnet 5 comparison for how this affects real-world use cases.
Step 8: Use Function Calling
Define tools that the model can call:
from google.genai import types
def get_weather(city: str) -> str:
"""Get the current weather for a city."""
return f"The weather in {city} is sunny and 72Β°F."
tools = types.Tool(function_declarations=[
types.FunctionDeclaration(
name="get_weather",
description="Get the current weather for a city",
parameters=types.Schema(
type=types.Type.OBJECT,
properties={
"city": types.Schema(type=types.Type.STRING, description="City name")
},
required=["city"]
)
)
])
response = client.models.generate_content(
model="gemini-3.6-flash",
contents="What is the weather in San Francisco?",
config=types.GenerateContentConfig(tools=[tools])
)
# Check if the model wants to call a function
if response.candidates[0].content.parts[0].function_call:
func_call = response.candidates[0].content.parts[0].function_call
print(f"Model wants to call: {func_call.name}({func_call.args})")
Function calling is how you build agents with Gemini. For a deeper dive into agent architectures, see our Best AI Models for Agents 2026 guide.
Step 9: Use Computer Use (New in 3.6)
Gemini 3.6 Flash has built-in computer use capability. The model can interact with browser and desktop environments through screenshots:
# Computer use requires the Gemini API with the computer_use tool enabled
# See the official Google documentation for the full setup
Computer use is a client-side tool. The model generates actions (click, type, scroll) and your application executes them. Googleβs OSWorld-Verified score for 3.6 Flash is 83.0%.
For more on computer use, see the official Google documentation.
Access via OpenRouter
If you prefer to use OpenRouter for multi-model routing:
import openai
client = openai.OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key="your-openrouter-key"
)
response = client.chat.completions.create(
model="google/gemini-3.6-flash",
messages=[
{"role": "user", "content": "Explain the MCP protocol."}
]
)
print(response.choices[0].message.content)
See our OpenRouter Complete Guide for more on multi-model routing.
Pricing Quick Reference
| Token Type | Price |
|---|---|
| Input | $1.50 per 1M tokens |
| Output | $7.50 per 1M tokens |
| Cached input | $0.15 per 1M tokens |
The cached input price is a 90% discount. Use it for repeated context like system prompts and tool definitions. See AI API Pricing Compared 2026 for the full pricing landscape.
My Take
Gemini 3.6 Flash is the easiest upgrade if you are already on 3.5 Flash. Same API, same SDK, just change the model name. The 17% token efficiency improvement means you get better results at lower cost without changing your code.
If you are new to Gemini, this is the model to start with. The 1M context window, multimodal input, and built-in computer use make it the most versatile option at this price point. The API is well-documented and the SDK is clean.
The only thing I wish Google would improve: the documentation for computer use is still sparse. The feature is powerful but the setup guide is not as polished as Anthropicβs computer use documentation.
FAQ
How do I get a Gemini API key?
Go to Google AI Studio, sign in with your Google account, and click βGet API Keyβ in the left sidebar. Create a new key and copy it. The free tier has rate limits; set up billing for production use.
Is Gemini 3.6 Flash free?
The free tier in Google AI Studio gives you access with rate limits. For production use, you need to set up billing. Pricing is $1.50/1M input tokens and $7.50/1M output tokens. See AI API Pricing Compared 2026 for details.
How is 3.6 Flash different from 3.5 Flash API?
The API is identical. Just change the model name from gemini-3.5-flash to gemini-3.6-flash. No code changes needed. 3.6 Flash is cheaper on output ($7.50 vs $9.00), faster (304 vs 289 tok/s), and has built-in computer use. See Gemini 3.6 Flash vs 3.5 Flash for the full comparison.
Can I use Gemini 3.6 Flash with OpenAI-compatible tools?
Yes. Use OpenRouter or similar services that provide OpenAI-compatible APIs for Gemini models. See our OpenRouter Complete Guide for setup instructions.
Does Gemini 3.6 Flash support streaming?
Yes. Use generate_content_stream (Python) or generateContentStream (Node.js) to stream responses. Streaming is essential for interactive applications where users need to see tokens appear immediately.