Gemini 3.8 Flash (gemini-3.8-flash) đã được phát hành rộng rãi (GA) và sẵn sàng để sử dụng trong quá trình sản xuất. Đây là mô hình Flash thông minh nhất của chúng tôi, được thiết kế cho hoạt động kỹ thuật phần mềm trong thời gian dài, các tác nhân tự trị và quy trình công việc phức tạp của doanh nghiệp.
Hướng dẫn này giải thích những điểm mới trong Gemini 3.8 Flash, các thay đổi về API, ví dụ về mã và hướng dẫn di chuyển.
Mô hình mới
| Mô hình | Mã kiểu máy | Cấp độ tư duy mặc định | Giá | Mô tả |
|---|---|---|---|---|
| Gemini 3.8 Flash | gemini-3.8-flash |
medium |
3.8 Flash được cung cấp đến hết năm với mức giá ưu đãi là 0,75 USD/1 triệu token đầu vào và 3,75 USD/1 triệu token đầu ra; hãy xem giá để biết thêm thông tin chi tiết. | Mô hình Flash thông minh nhất của chúng tôi, được thiết kế cho hoạt động kỹ thuật phần mềm trong thời gian dài, các tác nhân tự trị và quy trình công việc phức tạp của doanh nghiệp. |
Gemini 3.8 Flash hỗ trợ cửa sổ ngữ cảnh 1 triệu token, tối đa 64 nghìn token đầu ra, các cấp độ tư duy có thể điều chỉnh (low, medium, high) và bộ công cụ toàn diện tương tự.
Để biết đầy đủ thông số kỹ thuật, hãy xem trang mô hình Gemini 3.8 Flash. Để biết thông tin chi tiết về giá ưu đãi, hãy xem phần định giá bên dưới hoặc trang định giá.
Bắt đầu nhanh
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-3.8-flash",
input="Write a three.js script that renders a realistic 3D black hole."
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
model: "gemini-3.8-flash",
input: "Write a three.js script that renders a realistic 3D black hole.",
});
console.log(interaction.output_text);
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
Client client = new Client();
CreateModelInteraction req = CreateModelInteraction.builder()
.model(Model.of("gemini-3.8-flash"))
.input(InteractionsInput.of("Hello world"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(req)).interaction().get();
System.out.println(interaction.outputText().orElse(""));
REST
curl "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"model": "gemini-3.8-flash",
"input": "Write a three.js script that renders a realistic 3D black hole."
}'
Tính năng mới trong Gemini 3.8 Flash
- Kỹ thuật phần mềm trong thời gian dài: Mang lại kết quả tốt về các điểm chuẩn mã hoá trong thế giới thực, hoạt động tái cấu trúc phức tạp trên nhiều tệp và việc thực thi công cụ có tính xác định. Hãy xem phương pháp đánh giá để biết thông tin chi tiết.
- Tác nhân tự trị: Cho phép bạn xây dựng quy trình lập kế hoạch nhiều bước và điều phối công cụ có khả năng phục hồi, giúp giảm đáng kể các vòng lặp và lỗi không thành công.
- Quy trình công việc phức tạp của doanh nghiệp: Cung cấp độ chính xác vượt trội, khả năng suy luận sâu sắc và độ chính xác cao về thực tế trong các nhiệm vụ đòi hỏi khắt khe và quy trình dữ liệu quy mô lớn.
- Mô hình mặc định cho các Tác nhân được quản lý: Tác nhân mặc định cho các tác nhân được quản lý: Tác nhân Antigravity hiện sử dụng Gemini 3.8 Flash. Theo mặc định, Antigravity SDK cũng sử dụng Gemini 3.8 Flash.
- Giá ưu đãi: Gemini 3.8 Flash có giá ưu đãi là 0,75 USD/1 triệu token đầu vào và 3,75 USD/1 triệu token đầu ra cho đến hết ngày 31 tháng 12 năm 2026. Mức giá tiêu chuẩn là 1,5 USD/1 triệu token đầu vào và 7,5 USD/1 triệu token đầu ra sẽ có hiệu lực từ ngày 1 tháng 1 năm 2027.
Theo thiết kế, Gemini 3.8 Flash có thể sử dụng nhiều mã thông báo hơn cho các tác vụ phức tạp và kéo dài. Để mang lại kết quả chất lượng cao hơn cho các mục tiêu khó khăn, nhiều bước, mô hình này sẽ thực hiện các bước suy luận nhỏ hơn, gọi các công cụ lặp đi lặp lại và xác minh công việc của mình trong quá trình này. Không phải quy trình công việc nào cũng cần có mức xác minh này. Đối với các tác vụ hằng ngày, bạn có thể giảm mức độ nỗ lực suy luận để giảm mức tiêu thụ token. Ngoài ra, Gemini 3.7 Flash vẫn được hỗ trợ đầy đủ.
Tìm hiểu về các cấp độ suy luận
Gemini 3.8 Flash giúp bạn kiểm soát linh hoạt độ trễ và trí thông minh bằng cách điều chỉnh mức độ tư duy của mô hình:
- Ít tốn công sức suy nghĩ: Giảm thời gian trả lời cho các tác vụ quan trọng về độ trễ như quy trình phản hồi sự cố, trò chuyện theo thời gian thực, viết bản nháp và phân tích dữ liệu nhanh.
- Trung bình (mặc định): Chất lượng tốt nhất cho hầu hết các tác vụ. Được đề xuất cho mã phức tạp và các trường hợp sử dụng có tác nhân, mang lại độ chính xác cao hơn ở lần đầu tiên.
- Mức độ tư duy cao: Tối đa hoá khả năng suy luận và điều phối công cụ của mô hình. Phù hợp nhất cho suy luận sâu sắc, toán học và các nhiệm vụ khó khăn gồm nhiều bước.
Ví dụ sau đây đặt thinking_level thành medium cho một yêu cầu phân tích mã phức tạp:
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-3.8-flash",
input="Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
generation_config={
"thinking_level": "medium" # Balanced reasoning effort for complex tasks
}
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
model: "gemini-3.8-flash",
input: "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
generation_config: {
thinking_level: "medium"
}
});
console.log(interaction.output_text);
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
Client client = new Client();
CreateModelInteraction req = CreateModelInteraction.builder()
.model(Model.of("gemini-3.8-flash"))
.input(InteractionsInput.of("Hello world"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(req)).interaction().get();
System.out.println(interaction.outputText().orElse(""));
REST
curl "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"model": "gemini-3.8-flash",
"input": "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
"generation_config": {
"thinking_level": "medium"
}
}'
Đã cập nhật tác nhân Antigravity
Nhờ hiệu suất và khả năng suy luận được cải thiện, tác nhân Antigravity trong Gemini Managed Agents hiện được xây dựng bằng Gemini 3.8 Flash theo mặc định.
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
agent="antigravity-preview-05-2026",
input=(
"Audit https://web.dev for performance, Core Web Vitals, and SEO. "
"Query Google's PageSpeed Insights API for both Mobile and Desktop strategies. "
"Check search indexing with Google Search for site:web.dev. "
"Format the output as a side-by-side scorecard table with prioritized fixes."
),
environment="remote",
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
agent: "antigravity-preview-05-2026",
input: "Audit https://web.dev for performance, Core Web Vitals, and SEO. Query Google's PageSpeed Insights API for both Mobile and Desktop strategies. Check search indexing with Google Search for site:web.dev. Format the output as a side-by-side scorecard table with prioritized fixes.",
environment: "remote",
}, { timeout: 300000 });
console.log(interaction.output_text);
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
Client client = new Client();
CreateModelInteraction req = CreateModelInteraction.builder()
.model(Model.of("gemini-3.8-flash"))
.input(InteractionsInput.of("Hello world"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(req)).interaction().get();
System.out.println(interaction.outputText().orElse(""));
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"agent": "antigravity-preview-05-2026",
"input": "Audit https://web.dev for performance, Core Web Vitals, and SEO. Query Google'\''s PageSpeed Insights API for both Mobile and Desktop strategies. Check search indexing with Google Search for site:web.dev. Format the output as a side-by-side scorecard table with prioritized fixes.",
"environment": "remote"
}'
Bạn có thể định cấu hình mô hình Gemini cơ bản bằng cách sử dụng agent_config.
Danh sách kiểm tra cho quy trình di chuyển
`/gemini-api-dev migrate my app to Gemini 3.8 Flash`
Di chuyển sang gemini-3.8-flash
- Cập nhật mã nhận dạng mô hình: Thay đổi chuỗi mô hình mục tiêu thành
gemini-3.8-flash. - Xoá các thông số lấy mẫu không dùng nữa:
- Xoá
temperature,top_pvàtop_kkhỏi cấu hình tạo. - Thay thế
thinking_budgetbằng enum chuỗithinking_level. Xin lưu ý rằngminimalkhông được hỗ trợ trên Flash 3.8. - Xoá
candidate_count(không được hỗ trợ trong Gemini 3 trở lên).
- Xoá
- Thực thi các quy tắc xác thực lượt chơi:
- Chuẩn hoá các cuộc trò chuyện nhiều lượt trên
previous_interaction_idphía máy chủ. - Xoá các lượt được điền sẵn.
- Chuẩn hoá các cuộc trò chuyện nhiều lượt trên
- Kiểm tra lệnh gọi hàm:
- Đặt các thành phần đa phương thức vào tải trọng phản hồi.
- Định dạng hướng dẫn nội tuyến bằng cách sử dụng
\n\n. - Nếu bạn thấy lỗi
Malformed_Function_Callliên quan đến văn bản trước công cụ, hãy xem Giải pháp thay thế cho các yêu cầu về văn bản trước công cụ. - Chỉ khi sử dụng API generateContent: Đảm bảo tất cả các đối tượng
FunctionResponseđều cócall_idvàname.
- Các yêu cầu cơ bản đối với Gemini 3: Để biết thông tin về việc cập nhật SDK và giữ lại chữ ký tư duy, hãy xem Danh sách kiểm tra việc di chuyển sang Gemini 3.5.
Giá
Tận dụng mức giá ưu đãi cho người dùng mới trên Google AI Studio và Nền tảng Tác nhân Gemini Enterprise cho đến hết ngày 31 tháng 12 năm 2026 đối với Gemini 3.8 Flash, Gemini 3.7 Flash và Gemini 3.6 Flash. Giá thông thường sẽ có hiệu lực từ ngày 1 tháng 1 năm 2027. Để xem đầy đủ các cấp giá, hãy truy cập vào trang giá.
Các bước tiếp theo
- Xem quy cách API trên trang Tổng quan về các mô hình.
- Khám phá tính năng điều phối nhiều tác nhân trong phần Tổng quan về Interactions API.
- Kiểm thử và tinh chỉnh câu lệnh trong Google AI Studio.