Gemini 3.8 Flash 的新功能

查看所有型號

Gemini 3.8 Flash (gemini-3.8-flash) 已正式發布 (GA),可供正式環境使用。這是我們最聰明的 Flash 模型,專為長期軟體工程、自主代理和複雜的企業工作流程而設計。

本指南說明 Gemini 3.8 Flash 的新功能、API 異動、程式碼範例和遷移指南。

新增模型

模型 模型 ID 預設思考程度 定價 說明
Gemini 3.8 Flash gemini-3.8-flash medium 3.8 Flash 的新用戶優惠價為每 100 萬個輸入權杖 $0.75 美元,每 100 萬個輸出權杖 $3.75 美元,優惠期至年底為止。詳情請參閱定價 這是我們最聰明的 Flash 模型,專為長期軟體工程、自主代理和複雜的企業工作流程而設計。

Gemini 3.8 Flash 支援 100 萬個詞元的脈絡窗口、最多 6.4 萬個輸出詞元、可調整的思考程度 (lowmediumhigh),以及相同的內建工具套件。

如需完整規格,請參閱 Gemini 3.8 Flash 模型頁面。如需詳細的優惠價格資訊,請參閱下方的定價部分定價頁面

快速入門導覽課程

Python

from google import genai

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3.8-flash",
    contents="Write a three.js script that renders a realistic 3D black hole."
)

print(response.text)

JavaScript

import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});

const response = await ai.models.generateContent({
  model: "gemini-3.8-flash",
  contents: "Write a three.js script that renders a realistic 3D black hole.",
});

console.log(response.text);

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{
      "parts": [{"text": "Write a three.js script that renders a realistic 3D black hole."}]
    }]
  }'

Gemini 3.8 Flash 最新消息

  • 長期軟體工程:在實際程式碼基準測試、複雜的多檔案重構和確定性工具執行方面,都能提供出色的結果。詳情請參閱評估方法
  • 自主代理:可建構彈性的多步驟規劃和工具調度管理工作流程,大幅減少失敗的迴圈和錯誤。
  • 複雜的企業工作流程:在要求嚴苛的領域工作和大規模資料管道中,提供卓越的準確度、深入的推論能力和嚴謹的事實。
  • 受管理代理的預設模型:受管理代理的預設代理「Antigravity 代理」現在使用 Gemini 3.8 Flash。Antigravity SDK 預設也會使用 Gemini 3.8 Flash。
  • 優惠價格:2026 年 12 月 31 日前,Gemini 3.8 Flash 的優惠價格為每 100 萬個輸入詞元 $0.75 美元,每 100 萬個輸出詞元 $3.75 美元。標準定價為每 100 萬個輸入權杖 $1.50 美元,每 100 萬個輸出權杖 $7.50 美元,將於 2027 年 1 月 1 日生效。

根據設計,Gemini 3.8 Flash 可在長時間執行的複雜工作中使用更多權杖。為達成困難的多步驟目標,模型會採取較小的推論步驟、反覆呼叫工具,並在過程中驗證工作。並非所有工作流程都需要這種程度的驗證。如要執行日常工作,可以降低推論工作量,減少詞元消耗量。或者,Gemini 3.7 Flash 仍完全支援。

瞭解推理等級

Gemini 3.8 Flash 可調整模型的思考程度,讓您彈性控管延遲時間和智慧程度:

  • 降低思考深度:減少延遲時間,加快處理事件應變管道、即時通訊、草擬內容和快速資料分析等延遲時間至關重要的工作。
  • 中 (預設):適合大多數任務,可提供最佳品質。建議用於複雜程式碼和代理式用途,可提供更高的初步準確度。
  • 思考深度:盡可能發揮模型的推論和工具自動化調度管理能力。最適合用於深入推論、數學和困難的多步驟工作。

以下範例會將複雜的程式碼分析要求 thinking_level 設為 medium

Python

from google import genai
from google.genai import types

client = genai.Client()

response = client.models.generate_content(
    model="gemini-3.8-flash",
    contents="Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
    config=types.GenerateContentConfig(
        thinking_config=types.ThinkingConfig(
            thinking_level="medium"  # Balanced reasoning effort for complex tasks
        ),
    ),
)

print(response.text)

JavaScript

import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});

const response = await ai.models.generateContent({
  model: "gemini-3.8-flash",
  contents: "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
  config: {
    thinkingConfig: {
      thinkingLevel: "medium", // Balanced reasoning effort for complex tasks
    },
  },
});

console.log(response.text);

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.8-flash:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{
      "parts": [{"text": "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely."}]
    }],
    "generationConfig": {
      "thinkingConfig": {
        "thinkingLevel": "medium"
      }
    }
  }'

更新 Antigravity 代理程式

遷移檢查清單

  `/gemini-api-dev migrate my app to Gemini 3.8 Flash`

遷移至 gemini-3.8-flash

  • 更新模型 ID:將目標模型字串變更為 gemini-3.8-flash
  • 移除已淘汰的取樣參數:
    • 從生成設定中移除 temperaturetop_ptop_k
    • thinking_budget 替換為字串列舉 thinking_level。請注意,3.8 版 Flash 不支援 minimal
    • 移除 candidate_count (Gemini 3 以上版本不支援)。
  • 強制執行回合驗證規則:
    • 移除預先填入的模型回合。
    • 確認最終使用者輪流輸入的內容包含非空白文字。
  • 稽核函式呼叫:
    • 將多模態素材資源放在回應酬載中。
    • 使用 \n\n 格式設定內嵌指令。
    • 如果看到與前置工具文字相關的 Malformed_Function_Call 錯誤,請參閱「前置工具文字規定因應措施」。
    • 僅在使用 generateContent API 時:請確認所有 FunctionResponse 物件都包含 call_idname
  • Gemini 3 基準需求:如需 SDK 更新和思維簽章保留作業,請參閱 Gemini 3.5 遷移檢查清單

定價

在 2026 年 12 月 31 日前,透過 Google AI Studio 和 Gemini Enterprise Agent Platform 試用 Gemini 3.8 Flash、Gemini 3.7 Flash 和 Gemini 3.6 Flash,即可享有優惠價格。標準價格將於 2027 年 1 月 1 日生效。如需完整定價層級,請參閱定價頁面

後續步驟

  • 在「模型總覽」中查看 API 規格。
  • 請參閱「互動 API 總覽」一文,瞭解多代理自動化調度管理功能。
  • Google AI Studio 測試及調整提示。