SPB Git

Repository Public

latest-model.md 9.1 KB 171 lines markdown

1[See all models](https://ai.google.dev/gemini-api/docs/models)23Gemini 3.8 Flash (`gemini-3.8-flash`) is generally available (GA) and ready for production use. It is our most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows.45This guide explains what's new in Gemini 3.8 Flash, API changes, code examples, and migration guidance.67## New model89| Model | Model ID | Default thinking level | Pricing | Description |10|---|---|---|---|---|11| Gemini 3.8 Flash | `gemini-3.8-flash` | `medium` | 3.8 Flash is available through the end of year at an introductory price of $0.75/1M input tokens and $3.75/1M output tokens; see [pricing](https://ai.google.dev/gemini-api/docs/pricing) for more details. | Our most intelligent Flash model, engineered for long-horizon software engineering, autonomous agents, and complex enterprise workflows. |1213Gemini 3.8 Flash supports a 1M token context window, 64k max output tokens, tunable thinking levels (`low`, `medium`, `high`), and the same suite of built-in tools.1415For complete specs, see the [Gemini 3.8 Flash model page](https://ai.google.dev/gemini-api/docs/models/gemini-3.8-flash). For introductory pricing details, see the [pricing section](https://ai.google.dev/gemini-api/docs/generate-content/latest-model#pricing) below or the [pricing page](https://ai.google.dev/gemini-api/docs/pricing#gemini-3.8-flash).1617## Quickstart1819### Python2021    from google import genai2223    client = genai.Client()2425    response = client.models.generate_content(26        model="gemini-3.8-flash",27        contents="Write a three.js script that renders a realistic 3D black hole."28    )2930    print(response.text)3132### JavaScript3334    import { GoogleGenAI } from "@google/genai";3536    const ai = new GoogleGenAI({});3738    const response = await ai.models.generateContent({39      model: "gemini-3.8-flash",40      contents: "Write a three.js script that renders a realistic 3D black hole.",41    });4243    console.log(response.text);4445### REST4647    curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \48      -H "x-goog-api-key: $GEMINI_API_KEY" \49      -H 'Content-Type: application/json' \50      -X POST \51      -d '{52        "contents": [{53          "parts": [{"text": "Write a three.js script that renders a realistic 3D black hole."}]54        }]55      }'5657## What's new in Gemini 3.8 Flash5859- **Long-horizon software engineering:** Delivers strong results on real-world coding benchmarks, complex multi-file refactoring, and deterministic tool execution. See the [evaluation methodology](https://deepmind.google/models/evals-methodology/gemini-3-8-flash/) for details.60- **Autonomous agents:** Lets you build resilient multi-step planning and tool orchestration workflows, substantially reducing failed loops and errors.61- **Complex enterprise workflows:** Delivers superior accuracy, deep reasoning, and high factual rigor across demanding domain tasks and large-scale data pipelines.62- **Default model for Managed Agents:** The default agent for managed agents: the [Antigravity agent](https://ai.google.dev/gemini-api/docs/antigravity-agent), now uses Gemini 3.8 Flash. The [Antigravity SDK](https://antigravity.google/docs/sdk/overview/) also uses Gemini 3.8 Flash by default.63- **Introductory pricing:** Gemini 3.8 Flash is available at an introductory rate of $0.75/1M input tokens and $3.75/1M output tokens through December 31, 2026. Standard pricing of $1.50/1M input tokens and $7.50/1M output tokens takes effect January 1, 2027.6465Gemini 3.8 Flash can use more tokens on longer running and complex tasks, by design. To deliver higher-quality results on difficult, multi-step goals, the model takes smaller reasoning steps, calls tools iteratively, and verifies its work along the way. Not every workflow needs this level of verification. For everyday tasks, you can lower the [reasoning](https://ai.google.dev/gemini-api/docs/generate-content/latest-model#understanding-reasoning-levels) effort to reduce token consumption. Alternatively, Gemini 3.7 Flash remains fully supported.6667## Understanding reasoning levels6869Gemini 3.8 Flash gives you flexible control over latency and intelligence by adjusting the model's thinking level:7071- **Low thinking effort**: Reduces time-to-answer for latency-critical tasks like incident response pipelines, real-time chat, writing drafts, and fast data analysis.72- **Medium (default):** Best quality for most tasks. Recommended for complex code and agentic use cases, providing higher first-pass accuracy.73- **High thinking effort**: Maximizes the model's reasoning and tool orchestration capabilities. Best for deep reasoning, mathematics, and difficult multi-step tasks.7475> [!NOTE]76> **Note:** `minimal` thinking level is not supported for Gemini 3.8 Flash and will return an error.7778The following example sets `thinking_level` to `medium` for a complex code analysis request:7980### Python8182    from google import genai83    from google.genai import types8485    client = genai.Client()8687    response = client.models.generate_content(88        model="gemini-3.8-flash",89        contents="Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",90        config=types.GenerateContentConfig(91            thinking_config=types.ThinkingConfig(92                thinking_level="medium"  # Balanced reasoning effort for complex tasks93            ),94        ),95    )9697    print(response.text)9899### JavaScript100101    import { GoogleGenAI } from "@google/genai";102103    const ai = new GoogleGenAI({});104105    const response = await ai.models.generateContent({106      model: "gemini-3.8-flash",107      contents: "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",108      config: {109        thinkingConfig: {110          thinkingLevel: "medium", // Balanced reasoning effort for complex tasks111        },112      },113    });114115    console.log(response.text);116117### REST118119    curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \120      -H "x-goog-api-key: $GEMINI_API_KEY" \121      -H 'Content-Type: application/json' \122      -X POST \123      -d '{124        "contents": [{125          "parts": [{"text": "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely."}]126        }],127        "generationConfig": {128          "thinkingConfig": {129            "thinkingLevel": "medium"130          }131        }132      }'133134## Updated Antigravity agent135136> [!NOTE]137> **Note:** This feature requires the [Interactions API](https://ai.google.dev/gemini-api/docs/interactions-overview). The [Antigravity agent](https://ai.google.dev/gemini-api/docs/antigravity-agent) in Gemini Managed Agents is now built with Gemini 3.8 Flash by default. See the [Interactions API overview](https://ai.google.dev/gemini-api/docs/interactions-overview) for usage details and code samples.138139## Migration checklist140141> [!NOTE]142> **Note:** **Automate this migration with a coding agent.** If you use a coding agent that supports skills (like Antigravity), install the [gemini-api-dev skill](https://ai.google.dev/gemini-api/docs/coding-agents#gemini-api-dev) and run:143144      `/gemini-api-dev migrate my app to Gemini 3.8 Flash`145146### Migrate to gemini-3.8-flash147148- **Update Model ID:** Change your target model string to `gemini-3.8-flash`.149- **Remove deprecated sampling parameters:**150  - Strip `temperature`, `top_p`, and `top_k` from generation configs.151  - Replace `thinking_budget` with the string enum `thinking_level`. Note that `minimal` is not supported on 3.8 Flash.152  - Remove `candidate_count` (unsupported in Gemini 3 and later).153- **Enforce turn validation rules:**154  - Remove prefilled model turns.155  - Ensure the final user turn contains non-empty text.156- **Audit function calling:**157  - Place multimodal assets inside the response payload.158  - Format inline instructions using `\n\n`.159  - If you see `Malformed_Function_Call` errors tied to pre-tool text, see [Workarounds for pre-tool text requirements](https://ai.google.dev/gemini-api/docs/generate-content/function-calling#workarounds-for-pre-tool-text-requirements).160  - Only if using generateContent API: Ensure all `FunctionResponse` objects include `call_id` and `name`.161- **Baseline Gemini 3 requirements:** For SDK updates and thought signature preservation, see the [Gemini 3.5 Migration Checklist](https://ai.google.dev/gemini-api/docs/generate-content/whats-new-gemini-3.5#migration).162163## Pricing164165Take advantage of introductory pricing across Google AI Studio and Gemini Enterprise Agent Platform through December 31, 2026 for Gemini 3.8 Flash, Gemini 3.7 Flash, and Gemini 3.6 Flash. Standard pricing takes effect January 1, 2027. For complete pricing tiers, see the [pricing page](https://ai.google.dev/gemini-api/docs/pricing#gemini-3.8-flash).166167## Next steps168169- Review API specs on the [Models Overview](https://ai.google.dev/gemini-api/docs/models).170- Explore multi-agent orchestration in the [Interactions API Overview](https://ai.google.dev/gemini-api/docs/interactions-overview).171- Test and refine prompts in [Google AI Studio](https://aistudio.google.com/prompts/new_chat?model=gemini-3.8-flash).
Files main
Menu

Theme