Gemini 3.8 Flash 新特性
Gemini 3.8 Flash (gemini-3.8-flash)是我们最智能的 Flash 模型,专为长期软件工程、自主智能体和复杂的企业工作流程而设计。
本指南介绍了 Gemini 3.8 Flash、API 更改、代码示例和迁移指南中的新增内容。
新型号 #
| 模型 | 型号编号 | 默认思维水平 | 价格 | 说明 |
|---|---|---|---|---|
| Gemini 3.8 Flash | gemini-3.8-flash | medium | 3.8 Flash 将于年底上市,促销价为 $0.75/1M 输入 token 和 $3.75/1M 输出 token;看到 定价 了解更多详情。 | 我们最智能的 Flash 模型,专为长期软件工程、自主智能体和复杂的企业工作流程而设计。 |
Gemini 3.8 Flash 支持 1M token 上下文窗口,最大 64k 输出 token,可调思维级别(low, medium, high),以及与以前的 Flash 型号相同的内置工具套件。
有关完整规格,请参阅 Gemini 3.8 Flash 型号页面。有关介绍性定价的详细信息,请参阅 定价部分 稍后在本页或 定价页面.
快速入门 #
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)
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);
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。
- 介绍性定价: Gemini 3.8 Flash 的介绍价格为 $0.75/1M 输入 token 和 $3.75/1M 输出 token 至 12 月 31, 2026. 标准定价$1.50/1M 输入 token 和 $7.50/1M 输出 token 生效 1 月 1, 2027.
根据设计,Gemini 3.8 Flash 可以在运行时间较长和复杂的任务上使用更多的 token。为了在困难的多步骤目标上提供更高质量的结果,该模型采用更小的推理步骤,迭代调用工具,并在此过程中验证其工作。并非每个工作流程都需要这种级别的验证。对于日常任务,您可以降低 推理 努力减少token消耗。或者,Gemini 3.6 Flash 仍受支持。
了解推理水平 #
Gemini 3.8 Flash通过调整模型的思维水平,让您对延迟和智能进行灵活的控制:
- 低思考力:缩短事件响应管道、实时聊天、撰写草稿和快速数据分析等延迟关键型任务的响应时间。
- 中(默认): 大多数任务的最佳质量。推荐用于复杂代码和智能体用例,提供更高的首次通过精度。
- 高思维努力:最大化模型的推理和工具编排能力。最适合深度推理、数学和困难的多步骤任务。
注意: minimal Gemini 3.8 Flash 不支持思维级别,将返回错误。
下面的例子设置 thinking_level 到 medium 对于复杂的代码分析请求:
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)
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);
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-3.8-flash #
更新型号 ID: Change your target model string to
gemini-3.8-flash.配置思维层次: 更换
thinking_budget与字符串枚举thinking_level。请注意minimalGemini 3.8 Flash 不支持;选择low,medium(默认),或high.应用 Gemini 3 API 参数更改: 删除已弃用的采样参数(
temperature,top_p,top_k),candidate_count(Gemini 3 及更高版本中不支持)和预填充模型转弯。参见 Gemini 3.6 API 变更及参数更新.强制执行回合验证规则: 删除预填充的模型回合并确保最终用户回合包含非空文本。
审核函数调用: * 将多模态资产放入响应负载中。
- 使用格式化内联指令
\n\n. - 如果你看到
Malformed_Function_Call与工具前文本相关的错误,请参阅 工具前文本要求的解决方法. - 仅当使用generateContent API时:确保所有
FunctionResponse对象包括call_id和name.
- 使用格式化内联指令
基线 Gemini 3 要求: 有关 SDK 更新和思想签名保存,请参阅 思考签名.
价格 #
充分利用 Google AI Studio 和 Gemini Enterprise Agent Platform 的介绍性定价,直至 12 月 31, 2026、Gemini 3.8 Flash 和 Gemini 3.6 Flash。标准定价生效一月 1, 2027. 有关完整的定价等级,请参阅 定价页面.
其他型号 #
后续步骤 #
- 查看 API 规格 型号概览.
- 探索多智能体编排 Interactions API概述.
- 测试并完善提示 Google AI Studio.