Repository Public
1[3.6 Flash \& 3.5 Flash-Lite](https://ai.google.dev/gemini-api/docs/generate-content/latest-model)2[This page](https://ai.google.dev/gemini-api/docs/generate-content/whats-new-gemini-3.5#)34Gemini 3.5 Flash is **generally available (GA)**, stable, and ready for scaled5production use. As our most intelligent Flash model, it delivers sustained6frontier performance in agentic execution, coding, and long-horizon tasks at7scale.89This guide contains an overview of improvements, API changes, and migration10guidance for Gemini 3.5 Flash.1112## New model1314| Model | Model ID | Description |15|---|---|---|16| Gemini 3.5 Flash | `gemini-3.5-flash` | Our most intelligent model for sustained frontier performance in agentic and coding tasks. |1718Gemini 3.5 Flash supports the 1M token context window, 65k max output tokens,19thinking, and the same set of tools and platform features as Gemini 3 Flash,20including [Computer Use (Preview)](https://ai.google.dev/gemini-api/docs/computer-use).21For complete specs, see the [models overview](https://ai.google.dev/gemini-api/docs/models/gemini-3.5-flash).22For pricing, see the [pricing page](https://ai.google.dev/gemini-api/docs/pricing#gemini-3.5-flash).2324## Quickstart2526All examples in this guide use the GenerateContent API. The Interactions API is also supported; the same configuration options and recommendations apply.2728### Python2930 from google import genai3132 client = genai.Client()3334 response = client.models.generate_content(35 model="gemini-3.5-flash",36 contents="Explain how parallel agentic execution works in three sentences.",37 )38 print(response.text)3940### JavaScript4142 import { GoogleGenAI } from "@google/genai";4344 const ai = new GoogleGenAI({});4546 async function main() {47 const response = await ai.models.generateContent({48 model: "gemini-3.5-flash",49 contents: "Explain how parallel agentic execution works in three sentences.",50 });51 console.log(response.text);52 }5354 main();5556### REST5758 curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.5-flash:generateContent" \59 -H "x-goog-api-key: $GEMINI_API_KEY" \60 -H 'Content-Type: application/json' \61 -X POST \62 -d '{63 "contents": [{64 "parts": [{"text": "Explain how parallel agentic execution works in three sentences."}]65 }]66 }'6768## What's new6970- **Sustained frontier performance:** Our most intelligent Flash model, optimized for agentic and coding tasks at scale.71- **Agentic execution:** Sub-agent deployment, problem solving, and rapid agentic loops at scale.72- **Coding:** Iterative coding cycles, rapid exploration, and prototyping to test alternate paths and dynamically explore solutions.73- **Long horizon:** Multi-step workflows and tool use at scale.74- **Thought preservation:** The model maintains intermediate reasoning across multi-turn conversations automatically. No API changes needed.75- **New default effort level:** Default thinking effort changed from `high` to `medium`. See [New default effort level](https://ai.google.dev/gemini-api/docs/generate-content/whats-new-gemini-3.5#default-effort-level) for details.76- **Improved `low` thinking:** `low` is now significantly improved for code and agentic tasks that require fewer steps, offering strong quality at lower latency and cost.77- **GA release:** Stable model for scaled production use.7879### Choosing the right Flash model8081Gemini 3.5 Flash is our most intelligent and capable Flash model. However,82different use cases may have different cost and latency requirements.8384- **Gemini 3.1 Flash-Lite** : For low cost, high-volume tasks that don't require the advanced reasoning depth of 3.5 Flash, we recommend using [Gemini 3.1 Flash-Lite](https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-lite). It is a stable, long-term model optimized for efficiency. See the [Flash-Lite developer guide](https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-lite#developer_guide) for more details.85- **Gemini 3 Flash Preview** : While we recommend migrating to 3.5 Flash for GA stability and improved reasoning, [Gemini 3 Flash (Preview)](https://ai.google.dev/gemini-api/docs/models/gemini-3-flash-preview) remains available for developers who want to continue testing with the preview model.8687## Behavioral changes8889### New default effort level: `medium`9091The default thinking effort is now **`medium`** , changed from `high` in Gemini 392Flash Preview. `medium` yields very good results across a wide range of tasks93while being faster and more cost-efficient. For complex problems, `high`94encourages the model to think more deeply.9596| Effort level | When to use |97|---|---|98| `minimal` | Optimized for response speed. Chat-like use cases, quick factual answers, simpler tool calls. |99| `low` | Code and agentic tasks that require lower latency and fewer steps. Also works well for analysis and writing tasks that require some thinking. |100| **`medium` (default)** | **Best quality for most tasks. Recommended for complex code and agentic use cases.** |101| `high` | Maximizes the model's ability to think and use tools. Best for complex reasoning, hard math, and the most difficult code or agent tasks. Allows extended thoughts and function calls. |102103To override the default, set `thinking_level` in your config:104105### Python106107 from google import genai108 from google.genai import types109110 client = genai.Client()111112 response = client.models.generate_content(113 model="gemini-3.5-flash",114 contents="Prove that the square root of 2 is irrational.",115 config=types.GenerateContentConfig(116 thinking_config=types.ThinkingConfig(thinking_level="high")117 ),118 )119120 print(response.text)121122### JavaScript123124 import { GoogleGenAI } from "@google/genai";125126 const ai = new GoogleGenAI({});127128 async function main() {129 const response = await ai.models.generateContent({130 model: "gemini-3.5-flash",131 contents: "Prove that the square root of 2 is irrational.",132 config: {133 thinkingConfig: {134 thinkingLevel: "HIGH",135 },136 },137 });138 console.log(response.text);139 }140141 main();142143### REST144145 curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.5-flash:generateContent" \146 -H "x-goog-api-key: $GEMINI_API_KEY" \147 -H 'Content-Type: application/json' \148 -X POST \149 -d '{150 "contents": [{151 "parts": [{"text": "Prove that the square root of 2 is irrational."}]152 }],153 "generationConfig": {154 "thinkingConfig": {155 "thinkingLevel": "HIGH"156 }157 }158 }'159160> [!TIP]161> **Tip:** Start with `medium`, it provides the best quality for the vast majority of tasks. Try `low` for a faster, cheaper experience with strong quality. Switch to `high` for complex reasoning, hard math, or difficult coding challenges. Use `minimal` to optimize for speed in simple queries.162163The following table shows which thinking levels are supported per model:164165| Thinking Level | Gemini 3.5 Flash | Gemini 3.1 Pro | Gemini 3.1 Flash-Lite | Gemini 3 Flash | Description |166|---|---|---|---|---|---|167| **`minimal`** | Supported | Not supported | Supported (Default) | Supported | Matches the "no thinking" setting for most queries. Note, `minimal` does not guarantee that thinking is off, the model may reason very minimally for complex tasks. |168| **`low`** | Supported | Supported | Supported | Supported | Minimizes latency and cost. |169| **`medium`** | Supported (Default) | Supported | Supported | Supported | Balanced thinking for most tasks. |170| **`high`** | Supported (Dynamic) | Supported (Default, Dynamic) | Supported (Dynamic) | Supported (Default, Dynamic) | Maximizes reasoning depth. |171172> [!IMPORTANT]173> **Important:** You cannot use both `thinking_level` and the legacy `thinking_budget` parameter in the same request. Doing so will return a 400 error.174175### Thought preservation176177The model maintains intermediate reasoning across multi-turn conversations178automatically. When present in the conversation history, reasoning context179carries forward, which improves performance on complex multi-step tasks180like iterative debugging and code refactoring. No API changes needed:181182- **Interactions API**: Thoughts are already preserved automatically. No change in behavior.183- **GenerateContent API** : Beginning with Gemini 3.5 Flash, the model uses reasoning context from all previous turns when thought signatures are present in the conversation history. To enable this, pass the full, unmodified conversation history (including [thought signatures](https://ai.google.dev/gemini-api/docs/thought-signatures)) in `contents`. The SDKs handle this automatically.184185> [!NOTE]186> **Note:** When using the GenerateContent API, preserved thoughts increase input token count over multiple turns. For simple queries, you can clear them to reduce cost. See the [thought signatures guide](https://ai.google.dev/gemini-api/docs/thought-signatures#thought-preservation) for details.187188## Parameter updates and best practices in Gemini 3.x189190The following apply to **all Gemini 3.x models**, including Gemini 3.5 Flash.191192- **`temperature`, `top_p`, `top_k`**: we strongly recommend not changing the default values. Gemini 3's reasoning capabilities are optimized for the default settings.193- Use `thinking_level` instead of `thinking_budget`.194- **Function calling response matching** : `id`, `name`, and response count must match the preceding calls.195- **Multimodal function responses**: include multimodal content inside the function response, not outside it.196- **Inline instructions in function responses**: append to the function response text, not as separate parts.197- **Reduce unnecessary tool calls**: Use lower thinking levels or experiment with system instructions to reduce tool calls in agentic workflows.198199See the sections below for how to update your code.200201### Sampling parameters (no longer recommended)202203`temperature`, `top_p`, and `top_k` are no longer recommended for all Gemini2043.x models. Gemini 3's reasoning capabilities are optimized for the default205settings. **Remove these parameters from all requests.**206207 # ⚠️ Remove these parameters (not recommended)208 config = types.GenerateContentConfig(209 temperature=0.7,210 top_p=0.9,211 top_k=40212 )213214To ensure determinism, we recommend defining a system instruction with explicit rules for your specific use case.215216### `thinking_budget` (no longer recommended)217218The raw numeric `thinking_budget` parameter is no longer recommended across all219Gemini 3.x models. Use the `thinking_level` string enum instead.220221 # ⚠️ Before (not recommended)222 config = types.GenerateContentConfig(223 thinking_config=types.ThinkingConfig(thinking_budget=7500)224 )225226 # ✅ After227 config = types.GenerateContentConfig(228 thinking_config=types.ThinkingConfig(thinking_level="medium")229 )230231Available values: `minimal`, `low`, `medium` (default), and `high`.232233### Function calling: strict response matching234235The Interactions API already errors on mismatched function responses. The236GenerateContent API does not yet error, but mismatched responses cause the model237to return empty responses with `finish_reason: STOP` in most cases. Always238follow these conventions:239240| Requirement | Details |241|---|---|242| Include `id` | Every `FunctionResponse` must include the `id` from the corresponding `FunctionCall` |243| Match `name` | The `name` in the response must match the `name` in the call |244| Match counts | Return exactly one `FunctionResponse` for each `FunctionCall` received |245246### Python247248 # ✅ Include matching id and name in the function response249 final_response = client.models.generate_content(250 model="gemini-3.5-flash",251 config=config,252 contents=[253 *previous_contents,254 response.candidates[0].content,255 types.Content(role="user", parts=[256 types.Part.from_function_response(257 name=tool_call.name,258 response={"result": result},259 id=tool_call.id,260 )261 ]),262 ],263 )264265### JavaScript266267 // ✅ Include matching id and name in the function response268 const functionResponsePart = {269 functionResponse: {270 name: toolCall.name,271 response: { result: result },272 id: toolCall.id,273 },274 };275276 const finalResponse = await ai.models.generateContent({277 model: "gemini-3.5-flash",278 contents: [279 ...previousContents,280 { role: "model", parts: [{ functionCall: toolCall }] },281 { role: "user", parts: [functionResponsePart] },282 ],283 config: config,284 });285286### REST287288 curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.5-flash:generateContent" \289 -H "x-goog-api-key: $GEMINI_API_KEY" \290 -H 'Content-Type: application/json' \291 -X POST \292 -d '{293 "contents": [294 {"role": "user", "parts": [{"text": "..."}]},295 {"role": "model", "parts": [{"functionCall": {"name": "my_function", "args": {...}}}]},296 {"role": "user", "parts": [{"functionResponse": {"name": "my_function", "id": "call_id", "response": {"result": "..."}}}]}297 ]298 }'299300### Multimodal function responses301302We often see clients provide images outside function response. This can lead to303unexpected model behavior (e.g. thought leakage) and result in lower quality304outputs. Follow the recommendation in305[Multimodal Function Responses API docs](https://ai.google.dev/gemini-api/docs/function-calling?example=meeting#multimodal)306instead and include multimodal content in the function response parts that you307send to the model. The model can process this multimodal content in its next308turn to produce a more informed response.309310### Python311312 # ✅ Include multimodal content in the function response313 final_response = client.models.generate_content(314 model="gemini-3.5-flash",315 config=config,316 contents=[317 *previous_contents,318 response.candidates[0].content,319 types.Content(role="user", parts=[320 types.Part.from_function_response(321 name=tool_call.name,322 response={323 "result": "instrument.jpg",324 "image": base64_image_data,325 },326 id=tool_call.id,327 )328 ]),329 ],330 )331332### JavaScript333334 // ✅ Include multimodal content in the function response335 const finalResponse = await ai.models.generateContent({336 model: "gemini-3.5-flash",337 contents: [338 ...previousContents,339 { role: "model", parts: [{ functionCall: toolCall }] },340 {341 role: "user",342 parts: [{343 functionResponse: {344 name: toolCall.name,345 id: toolCall.id,346 response: {347 result: "instrument.jpg",348 image: base64ImageData,349 },350 },351 }],352 },353 ],354 config: config,355 });356357### Inline instructions in function responses358359We often see clients provide additional instructions along with function responses360as subsequent `Parts`. This can lead to unexpected model behavior (e.g.361thought leakage) and result in lower quality outputs. Instead, append any extra362instructions to the end of the function response text separated by two newlines.363364### Python365366 # ✅ Append inline instructions to the end of the function response separated by two newlines367 result_text = f"{json.dumps(result)}\n\n<your inline instructions>"368369 final_response = client.models.generate_content(370 model="gemini-3.5-flash",371 config=config,372 contents=[373 *previous_contents,374 response.candidates[0].content,375 types.Content(role="user", parts=[376 types.Part.from_function_response(377 name=tool_call.name,378 response={"result": result_text},379 id=tool_call.id,380 )381 ]),382 ],383 )384385### JavaScript386387 // ✅ Append inline instructions to the end of the function response separated by two newlines388 const resultText = `${JSON.stringify(result)}\n\n<your inline instructions>`;389390 const finalResponse = await ai.models.generateContent({391 model: "gemini-3.5-flash",392 contents: [393 ...previousContents,394 { role: "model", parts: [{ functionCall: toolCall }] },395 {396 role: "user",397 parts: [{398 functionResponse: {399 name: toolCall.name,400 id: toolCall.id,401 response: { result: resultText },402 },403 }],404 },405 ],406 config: config,407 });408409### Reducing unnecessary tool calls410411If you experience an overuse of tool calls, two techniques help minimize them:4124131. **Start by reducing the thinking level** (`medium`, `low`, or `minimal`):414 Higher thinking levels encourage the model to use more tools to explore and415 verify, so lowering the level can reduce tool calls.4164172. **Add a system instruction:** If overuse persists after adjusting the418 thinking level, consider a prompt that restricts tool usage. For example:419420 You have a limited action budget of <n> tool calls. Use them efficiently.421422## Migration checklist423424### Migrate from Gemini 3 Flash Preview425426- Update model name: `gemini-3-flash-preview` → `gemini-3.5-flash`427- Review pricing. Gemini 3.5 Flash is more expensive than Gemini 3 Flash Preview. If your use case is highly cost-sensitive, consider migrating to [Gemini 3.1 Flash-Lite](https://ai.google.dev/gemini-api/docs/models/gemini-3.1-flash-lite) instead. See the [pricing page](https://ai.google.dev/gemini-api/docs/pricing#gemini-3.5-flash) for details.428- Remove `temperature`, `top_p`, `top_k` from your config (no longer recommended).429- Replace `thinking_budget` with `thinking_level`.430- Add `id` and matching `name` to all `FunctionResponse` parts.431- Test your prompts. Default effort changed from `high` → `medium`; verify quality, speed, and cost.432- Thought preservation is now on by default. Reasoning context carries forward across turns, which improves performance but may increase token usage.433- Reduce unnecessary tool calls: start by reducing the thinking level (`medium`, `low`, or `minimal`); add a system instruction to constrain tool usage if overuse persists.434- [Computer Use](https://ai.google.dev/gemini-api/docs/computer-use) is supported.435436### Migrate from Gemini 2.5437438All of the above, plus:439440- Simplify prompts. If you used chain-of-thought prompt engineering to force reasoning, try `thinking_level: "medium"` or `"high"` with simpler prompts instead.441- Test PDF and media workloads. If you relied on specific behavior for dense document parsing, test the `media_resolution_high` setting to ensure continued accuracy. Migrating to Gemini 3 defaults may also increase token usage for PDFs but decrease it for video; if requests exceed the context window, explicitly reduce the `media_resolution`. See the [media resolution](https://ai.google.dev/gemini-api/docs/media-resolution) docs for details.442- Leverage [combined tool use](https://ai.google.dev/gemini-api/docs/tool-combination). Google Search, URL context, code execution, and custom functions can be used in the same request.443- If using multimodal function responses, move multimodal content inside function response parts, not alongside them.444- If using inline instructions with function responses, append them to the function response text separated by two newlines, not as separate parts.445- Image segmentation is not supported in Gemini 3.x. For segmentation workloads, continue using Gemini 2.5 Flash with thinking off.446- Remove `candidate_count` from your config (not supported in Gemini 3.x)447448## Gemini 3 family features449450Gemini 3.5 Flash inherits all Gemini 3 family capabilities, including Computer Use.451Features introduced in Gemini 3 that carry forward:452453- [**Thinking**](https://ai.google.dev/gemini-api/docs/thinking)**:** Encrypted reasoning context preserved across API calls. Automatic in the Interactions API; implicit in GenerateContent.454- [**Structured outputs with tools**](https://ai.google.dev/gemini-api/docs/structured-output)**:** Combine JSON mode with built-in tools (Search, URL context, code execution, function calling).455- [**Multimodal function responses**](https://ai.google.dev/gemini-api/docs/function-calling#multimodal)**:** Return images, audio, and other media in function call results.456- [**Code execution with images**](https://ai.google.dev/gemini-api/docs/code-execution#images)**:** Execute code that processes and generates images.457- [**Combined tool use**](https://ai.google.dev/gemini-api/docs/tool-combination)**:** Use built-in tools and custom function calling in the same request.458- [**Media resolution**](https://ai.google.dev/gemini-api/docs/media-resolution)**:** Fine-grained control over token allocation for image, video, and PDF inputs. Gemini 3 models support per-content-item resolution settings (`low`, `medium`, `high`, `ultra_high`) for mixed-fidelity prompts.459- [**Thought signatures**](https://ai.google.dev/gemini-api/docs/thought-signatures)**:** Encrypted representations of the model's internal reasoning. Required for multi-turn function calling; managed automatically by the official SDKs.460461## Prompting best practices462463Gemini 3.x models are reasoning models, which changes how you should prompt.464465- **Precise instructions:** Be concise. Gemini 3.x responds best to direct, clear instructions. Verbose or complex prompt engineering techniques designed for older models may cause the model to over-analyze.466- **Output verbosity:** By default, Gemini 3.x is less verbose and prefers direct, efficient answers. If your use case requires a conversational tone, steer the model explicitly in your prompt (for example, "Explain this as a friendly, talkative assistant").467- **Context management:** When working with large datasets (such as entire books, codebases, or long videos), place your specific instructions or questions at the end of the prompt, after the data context. Anchor the model's reasoning by starting your question with a phrase like, "Based on the preceding information...".468469Learn more about prompt design strategies in the470[prompt engineering guide](https://ai.google.dev/gemini-api/docs/prompting-strategies).471472## Limitations473474- Image segmentation is not supported in Gemini 3.x. For segmentation workloads, continue using Gemini 2.5 Flash with thinking off, or [Gemini Robotics ER 2](https://ai.google.dev/gemini-api/docs/robotics-overview).475476## FAQ4774781. **What is the knowledge cutoff for Gemini 3.5 Flash?** Gemini 3.5 Flash479 has a knowledge cutoff of January 2025. For more recent information, use the480 [Search Grounding](https://ai.google.dev/gemini-api/docs/google-search) tool.4814822. **What are the context window limits?** Gemini 3.5 Flash supports a 1483 million token input context window and up to 65k output tokens.4844853. **Will my old `thinking_budget` code still work?** Yes, `thinking_budget`486 is still supported for backward compatibility, but we recommend migrating to487 `thinking_level` for more predictable performance. Don't use both in the488 same request.4894904. **Does Gemini 3.5 Flash support the Batch API?** Yes. See the491 [Batch API](https://ai.google.dev/gemini-api/docs/batch-api) guide for details.4924935. **Is Context Caching supported?** Yes,494 [Context Caching](https://ai.google.dev/gemini-api/docs/caching) is supported.4954966. **Which tools are supported?** Gemini 3.5 Flash supports497 [Google Search](https://ai.google.dev/gemini-api/docs/google-search),498 [Grounding with Google Maps](https://ai.google.dev/gemini-api/docs/maps-grounding),499 [File Search](https://ai.google.dev/gemini-api/docs/file-search),500 [Code Execution](https://ai.google.dev/gemini-api/docs/code-execution),501 [URL Context](https://ai.google.dev/gemini-api/docs/url-context), and502 standard [Function Calling](https://ai.google.dev/gemini-api/docs/function-calling),503 including504 [combined tool use](https://ai.google.dev/gemini-api/docs/tool-combination), and505 [Computer Use](https://ai.google.dev/gemini-api/docs/computer-use).506507## Next steps508509- Learn more about prompt design strategies in the [prompt engineering guide](https://ai.google.dev/gemini-api/docs/prompting-strategies).510- Get started with the [Gemini 3 Cookbook](https://github.com/google-gemini/cookbook)511- Learn about [Gemini API optimization and inference](https://ai.google.dev/gemini-api/docs/optimization)